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

◆ blend_oklab()

CRGB fl::blend_oklab ( const CRGB & p1,
const CRGB & p2,
fract8 amountOfP2 )

Definition at line 135 of file colorutils.cpp.hpp.

135 {
136 if (amountOfP2 == 0) { return p1; }
137 if (amountOfP2 == 255) { return p2; }
138
139 const Oklab first = rgbToOklab(p1);
140 const Oklab second = rgbToOklab(p2);
141 const float amount = static_cast<float>(amountOfP2) / 255.0f;
142 const Oklab mixed = {
143 first.lightness + (second.lightness - first.lightness) * amount,
144 first.green_red + (second.green_red - first.green_red) * amount,
145 first.blue_yellow + (second.blue_yellow - first.blue_yellow) * amount,
146 };
147 return oklabToRgb(mixed);
148}
CRGB oklabToRgb(const Oklab &lab) FL_NO_EXCEPT
Oklab rgbToOklab(const CRGB &rgb) FL_NO_EXCEPT