Design Philosophy
These are a collection of functions to convert from red, green, blue (RGB) to hue, saturation, value (HSV) color spaces.
Functions can also convert between the paletteColor_t enum and the RGB color space.
Usage
Call the functions as necessary.
Example
uint8_t hue = 0xFF;
uint8_t sat = 0xFF;
uint8_t val = 0xFF;
paletteColor_t RGBtoPalette(uint32_t rgb)
Find the palette color closest to the given 32 bit RGB color.
Definition color_utils.c:158
paletteColor_t paletteHsvToHex(uint8_t hue, uint8_t sat, uint8_t val)
This converts a hue, saturation, and value (HSV) into paletteColor_t color.
Definition color_utils.c:147
led_t LedEHSVtoHEXhelper(uint8_t hue, uint8_t sat, uint8_t val, bool applyGamma)
This converts a hue, saturation, and value (HSV) into led_t color.
Definition color_utils.c:129
uint32_t EHSVtoHEXhelper(uint8_t hue, uint8_t sat, uint8_t val, bool applyGamma)
This converts a hue, saturation, and value (HSV) into 32 bit RGB (0xBBGGRR)
Definition color_utils.c:43
uint32_t paletteToRGB(paletteColor_t pal)
Find the 32 bit RGB color for the given palette color.
Definition color_utils.c:175
LED colors, with red, green, and blue components.
Definition hdw-led.h:63
paletteColor_t
All 216 possible colors, named like cRGB.
Definition palette.h:23
@ c345
r = 3, g = 4, b = 5
Definition palette.h:161
|
uint32_t | EHSVtoHEXhelper (uint8_t hue, uint8_t sat, uint8_t val, bool applyGamma) |
| This converts a hue, saturation, and value (HSV) into 32 bit RGB (0xBBGGRR)
|
|
led_t | LedEHSVtoHEXhelper (uint8_t hue, uint8_t sat, uint8_t val, bool applyGamma) |
| This converts a hue, saturation, and value (HSV) into led_t color.
|
|
paletteColor_t | paletteHsvToHex (uint8_t hue, uint8_t sat, uint8_t val) |
| This converts a hue, saturation, and value (HSV) into paletteColor_t color.
|
|
paletteColor_t | RGBtoPalette (uint32_t rgb) |
| Find the palette color closest to the given 32 bit RGB color.
|
|
uint32_t | paletteToRGB (paletteColor_t pal) |
| Find the 32 bit RGB color for the given palette color.
|
|