-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can I use HSLuv to make a "Rainbow" hue chart? #40
Comments
After playing with the code I've linked to I think these two colors should be equivalent: If others agree that this should be true, then I don't think I need to convert anything. For some more context, I'm trying to wrap my head around these two rainbows I made: The top one is There is another RGB concept called the "rainbow" hue chart that the FastLED library talks about.
I like the look of the "Rainbow" spectrum the most because it attempts to evenly spread the hues, where as my second rainbow (the standard RGB rainbow) the green is a lot wider than the teal or purple. I'm not sure if the width of a hue HSLuv is even like it is in "Rainbow", but it appears "less vivid", so I'm inclined to not use it for my use case. So my new question is, can I use HSLuv to make a "Rainbow" hue chart? |
I did some experiments with HSLuv to implement it for FastLED. I didn't continue with it, because brightness is much lower in some colours (notably yellow). |
There are separate issues here.
If you are finding yellow to not be saturated enough, you have to add lightness. A saturated yellow must by necessity be light and a dark yellow must by necessity be unsaturated. A dark saturated yellow is an impossible color. |
Thank you for the responses! So, if I understand this correctly,
I wonder then what I should use to design an evenly spaced, super pleasing rainbow with my LEDs? If I have some time this weekend, I'll experiment a bit with some LED circuits I have and record cycling through different rainbows :) |
Choosing HSLuv, HSL and FastLED HSL. Firstly, I don't see any advantage of plain HSL over FastLED HSL, so we can drop that one. For your purpose, the choice between HSLuv and FastLED HSL I think is a matter of aesthetics. The color bands in an actual, real-world rainbow do not appear to have the same lightness, and may indeed look closer to HSL than HSLuv. Where HSLuv's lightness is really useful is in generating contrasting colors, e.g. for foreground and background. I would be interested to know how your experiments turn out :) |
FastLED HSV is a bit different, see: https://plus.google.com/+KasperKamperman/posts/ceLmqbpxRUG In the end it's about the effect that you like. My advise is to generate a (rainbow) lookuptable of the HSLuv (you can easy print to an array in Processing and copy-paste it) and test it with FastLed on for example a Teensy. |
@chrisgervang |
@chrisgervang: you might be interested in this talk: A Better Default Colormap for Matplotlib | SciPy 2015 | Nathaniel Smith and Stéfan van der Walt It explains color theory in a way that makes the whole idea behind CIELuv thing easy to understand, and by extension HSLuv a lot easier too. |
Is there a version of |
I think HSL is convertible to HSV. I’d refer to the conversion formula on wiki https://en.m.wikipedia.org/wiki/HSL_and_HSV#Interconversion |
@chrisgervang , It is known for regular |
I work with a color-space I call HCG (Hue, Chroma-proportional, Gray), where Chroma is a percent proportional to the maximum chroma that can be displayed for the given hue in the RGB (e.g. sRGB) color-space used by the computer. This seems to be what you are looking for, in a way. Maximum Chroma is: one RGB channel is maximum (255 in sRGB), one channel is minimum (0), the third varies. (minimum chroma is all gray-tones) So the Wikipedia link will not help anyone here, because that formula will depend on HSL having a "stable" location for "maximum chroma", but good try. I might scoop up this formula for other uses, anyway...☺ In the mean time, I'm looking for HSVᵤᵥ also..... |
@SoftMoonWebWare I think what you call "Chroma-proportional" is same as Saturation in HSLuv. To make this possible, we need to calculate the maximum chroma for a given hue and lightness. See: https://github.com/hsluv/hsluv-python/blob/b1bfc09fb3fbf8da9d4da3b13ebd3f9795055972/hsluv.py#L80 |
What kind of approach is necessary to convert between HSLuv and HSV? is it a linear conversion?
I'd like to build a color wheel where the user can change hue, and always get the most saturated and vibrate version of that hue.
This is different than lightness, since the "most vibrant" color have different lightnesses depending on which hue we're talking about.
There are lots of attempts to convert between the two, but I'm not sure what the correct approach would be, and I was wondering if some people in this community could share some thoughts on the subject :)
The text was updated successfully, but these errors were encountered: