FastLED 3.10.8
Loading...
Searching...
No Matches

◆ rgbToHex()

fl::string fl::wled::rgbToHex ( u8 r,
u8 g,
u8 b )

Convert RGB components to hex string.

Parameters
rRed component (0-255)
gGreen component (0-255)
bBlue component (0-255)
Returns
Hex color string (format: "RRGGBB")

Definition at line 48 of file json_helpers.cpp.hpp.

48 {
50 hex.reserve(6);
51
52 auto byteToHex = [](u8 val) -> fl::string {
53 const char hexChars[] = "0123456789ABCDEF";
55 result.push_back(hexChars[val >> 4]);
56 result.push_back(hexChars[val & 0x0F]);
57 return result;
58 };
59
60 hex += byteToHex(r);
61 hex += byteToHex(g);
62 hex += byteToHex(b);
63
64 return hex;
65}
unsigned char u8
Definition stdint.h:131
const hex_t hex
Definition ios.cpp.hpp:11
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31
InputGamut g
Definition rgbw.h:125

References fl::FL_NO_EXCEPT, fl::g, and fl::hex.

Referenced by fl::WLED::getState().

+ Here is the caller graph for this function: