Search code examples
language-agnosticcolorsrgb

Paint me a Rainbow


How would you go about making a range of RGB colours evenly spaced over the spectral colour range? So as to look like a real rainbow.


Solution

  • Use HSL instead: fix the brightness and saturation and vary the hue from 0 to 360, then convert to RGB.

    HSL describes colors as they are perceived by people. RGB describes them as they are used by machines. So you can't really do anything visually pleasing directly using RGB.