Ideally, the luminance of all colors should stay the same, but the RGB color model is highly nonlinear. The CIELAB color space (either L*a*b* or LCh coordinates) has the best linearity – maybe there’s a function you can use, which generates colors based on that color model?
Other color models which are quite OK-ish are LMS and the HSV/HSL/HSB/HSI variants – but LAB is by far the best. With the continuous color transitions of that rainbow effect this gets especially obvious! In my screen shot you see the second line being solely green – whereas the third line contains bright blue, normal blue, dark blue and purple.
Ideally, the luminance of all colors should stay the same, but the RGB color model is highly nonlinear. The CIELAB color space (either
L*a*b*
orLCh
coordinates) has the best linearity – maybe there’s a function you can use, which generates colors based on that color model?Other color models which are quite OK-ish are LMS and the HSV/HSL/HSB/HSI variants – but LAB is by far the best. With the continuous color transitions of that rainbow effect this gets especially obvious! In my screen shot you see the second line being solely green – whereas the third line contains bright blue, normal blue, dark blue and purple.
Here you find more information about CIELAB and how to use it from the GIMP people: https://ninedegreesbelow.com/photography/lch-vs-hsv-for-picking-colors.html