Ramping color swatches

In Looking up color table I showed how to look up colors from a growing table of color models, in order to create color swatches. These show distinct colors with a hard stop between them, like this

But lets say that we wanted the intermediate colors to be automatically calculated - creating a smooth transition between each color.

Creating Ramps to get between colors smoothly

You can calculate the transition between two colors by adjusting the red, blue and green mix proportional to the distance traveled between the source and target color. Putting it all together, you can see the smooth transition between each color in the swatch, compared to the discrete individual color components.

How does this work

This is covered in detail in the Color ramp library. Here's the code for creating the diagram above, using the libraries in the cDataSet.xlsm workbook.

create ramps from the color library

For help and more information join our forum,follow the blog or follow me on twitter.