How to convert angles to colors (and vice versa)
Angle → Color
- Convert given angle radians to degrees
- Account for possible negative values → +360
- Account for color placement on our specific wheel.
- See HSV color wheel compared to our version of the color wheel. Where is the placement of red? The transformation that takes the “real” hue wheel to our orientation? → +90 (degrees counter clockwise)
- Convert degrees to hue
- Assume each degree corresponds to a specific hue → % 360
- Hue → HSV: Color = hue, saturation, value.
- Assume full saturation and value for our wheel (1f).
- Convert HSV to Color (an int)
- See a handy method inside Color class
Color → Angle
- What is a RGB color as an int? Read this part in Color Picker spec
- Color (int) → HSV, again assume full saturation and value. See ColorUtils documentation for a handy method.
- HSV → hue
- HSV is in the form of a float array with 3 values… which of these three do you need?
- Hue → radians (see Angle to Color steps backward)
HSV vs HSL
See this image https://i.stack.imgur.com/nX8NL.png
- Hue: color (red green… etc)
- Saturation: how much color
- Lightness: how “light” it is (closer to white), lightness value of 0 = black, 1 = white
- Value: how much black mixed into color, value = 1 = full color. Value = 0 = black.
HSV Model
HSL Model