FastLED 3.10.6
Loading...
Searching...
No Matches

◆ crgbJsonPixel()

optional< CRGB > fl::anonymous_namespace{crgb_json.cpp.hpp}::crgbJsonPixel ( const json & value)

Definition at line 18 of file crgb_json.cpp.hpp.

18 {
19 if (!value.is_array() || value.size() != 3) {
20 return fl::nullopt;
21 }
22
23 const optional<i64> red = crgbJsonChannel(value[0]);
24 const optional<i64> green = crgbJsonChannel(value[1]);
25 const optional<i64> blue = crgbJsonChannel(value[2]);
26 if (!red || !green || !blue) {
27 return fl::nullopt;
28 }
29
30 return CRGB(static_cast<u8>(*red), static_cast<u8>(*green),
31 static_cast<u8>(*blue));
32}
unsigned char u8
Definition stdint.h:131
optional< i64 > crgbJsonChannel(const json &value) FL_NO_EXCEPT
fl::CRGB CRGB
Definition video.h:18
constexpr int type_rank< T >::value
Optional< T > optional
Definition optional.h:16
constexpr nullopt_t nullopt
Definition optional.h:13

References crgbJsonChannel(), crgbJsonPixel(), fl::FL_NO_EXCEPT, fl::nullopt, and fl::type_rank< T >::value.

Referenced by crgbJsonMatches(), and crgbJsonPixel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: