Gradient Color Space
April 26, 2022 ยท View on GitHub
A tool to convert a simple Unity.Gradient into a peicewise gradient interpolated in another color space. Useful to create nice looking gradients and avoid 'muddy' or perceptionally incorrect interpolated colors.
Installation
Installation via the Unity Package Manager.
OpenUPM
- In Unity on the top toolbar, go to
Edit > Project Settings > Package Manager. - Add a new Scoped Registry (or edit the existing OpenUPM entry)
Name package.openupm.com
URL https://package.openupm.com
Scope(s) com.popupasylum.gradientcolorspace
- Click Save (or Apply)
- Open
Window > Package Manager - Next to the
+icon, selectMy Registries - Select
Gradient Color Spaceand click install on the bottom right.
Git
- In Unity on the top toolbar, go to
Window > Package Manager. - Click the
+icon and selectAdd package from Git URL. - Enter the Git URL of this repository
https://github.com/markeahogan/GradientColorSpace.git.
Gradient Conversion
A Gradient with 2 keys can be converted into a piecewise gradient with the appearance of another color space using the GradientColorSpace.ConvertGradient method. It creates 6 keys between the first and last keys that are interpolated from the first to last color using the chosen color space.
Original Gradient

Oklab Conversion

SRLAB2 Conversion

Context Menu
Right-clicking a gradient property's label will show a 'Color Space' context menu, allowing quick conversion.
