Color Bands

New Features

25/08/2016 [Feature request] Color spaces. ColorBand now supports HSV input.

15/08/2016 ColorBand now supports discretization which subdivides the ColorBand into constant intervals.


Unity 3D’s Gradient is a handy data type but comes with some limitations: for example you cannot set more than 8 color keys in its editor and RGB is the only color space available. ColorBand data type offers an alternative with less limitations. Creating ColorBands is fun and easy; they are stored as assets and can be accessed from code through an Evaluate method to get the color at time t, as for Gradient. RGB (or HSV) values are described by individual curves, allowing a better control over how the color function evolves between your points. Color bands are used in all kinds of applications including games, data visualization and other fields.


Examples of color bands you cannot obtain with Unity’s Gradient

You cannot do this with Unity 01

You cannot do this with Unity 02

You cannot do this with Unity03


  1. Create a new Color Band asset


Newly created ColorBands will be placed in Assets folder’s root.

  1. Change its name and its red, green, blue and alpha curves to obtain the desired effect. You can hit Set as filename to quickly set the name from the new color band’s filename. Note that curves’ values should remain between 0 and 1 in both dimensions time and value.



  1. Declare a public ColorBand variable in your script

  2. Assign a color band asset to it

  3. Use it in code by calling the ColorBand.Evaluate(float t) method where t is a floating point value between 0 and 1.



A ColorBand can be discretized which means it will be turned into a set of flat intervals that will return a constant color. To make a ColorBand discrete just set its discrete toggle to true and decide the number of steps the ColorBand will be subdivided into. This will result in discrete bands like the following:


Three different discretization methods are available:

  • LEFT_VALUE will build color intervals by evaluating the color at their left extreme.
  • RIGHT_VALUE will build color intervals by evaluating the color at their right extreme.
  • CENTER_VALUE will build color intervals by evaluating the color at their center.

Color Space


ColorBands can be described in the two main, standard color spaces RGB and HSV. By default a ColorBand will be set to RGB. When changing color space all the curves remain unvaried but they represent the respective values of the two spaces so that when switching to HSV, the first curve becomes hue, the second one saturation and the third one value. The alpha curve has the same meaning in both color spaces.