FastLED 3.9.15
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 47 of file json_helpers.cpp.hpp.

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

References fl::hex.

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

+ Here is the caller graph for this function: