Color
Conversion helpers between common color spaces. All helpers operate on plain numeric tuples — RGB and HSL/HSV are returned as [a, b, c] arrays, hex values are strings prefixed with #.
Conversions
hexToRGB—#rrggbbto[r, g, b].rgbToHEX—[r, g, b]to#rrggbb.rgbToHSL—[r, g, b]to[h, s, l].rgbToHSV—[r, g, b]to[h, s, v].hslToRGB—[h, s, l]to[r, g, b].hslToHSV—[h, s, l]to[h, s, v].hsvToRGB—[h, s, v]to[r, g, b].hsvToHSL—[h, s, v]to[h, s, l].
Internals
Conventions
- RGB components are integers in the range
0..255. - Hue is in degrees
0..360(or normalized0..1when used withhsvToRGB). - Saturation and lightness/value are percentages
0..100for HSL/HSV inputs as documented per function. - Hex strings use the short
#rrggbbform with a leading#.