# Color Functions
# Description
Color processing functions provided in the SDK, used for converting and operating on color formats such as RGB and RGBA.
# How to Use
// RGB to hexadecimal
const char* hex_color = rgb_to_hex(255, 128, 0); // Returns "#FF8000"
// Hexadecimal to RGB
int r, g, b;
hex_to_rgb("#FF8000", &r, &g, &b); // r=255, g=128, b=0
# rgb_to_hex
const char* rgb_to_hex(int r, int g, int b)
Converts RGB color values to a hexadecimal color code.
Parameter | Type | Description |
---|---|---|
r | int | Red component (0-255) |
g | int | Green component (0-255) |
b | int | Blue component (0-255) |
const char* hex_color = rgb_to_hex(255, 128, 0); // Returns "#FF8000"
# hex_to_rgb
void hex_to_rgb(const char* hex, int* r, int* g, int* b)
Converts a hexadecimal color code to RGB color values.
Parameter | Type | Description |
---|---|---|
hex | const char* | Hexadecimal color code |
r | int* | Red component output pointer |
g | int* | Green component output pointer |
b | int* | Blue component output pointer |
int r, g, b;
hex_to_rgb("#FF8000", &r, &g, &b); // r=255, g=128, b=0