1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-02 11:22:24 +01:00

add gradient color (#3687)

This commit is contained in:
NP v/d Spek
2022-08-09 02:29:41 +02:00
committed by GitHub
parent e2cddf1005
commit 34df7a6072

View File

@@ -141,6 +141,7 @@ struct Color {
}
Color fade_to_white(uint8_t amnt) { return Color(255, 255, 255, 255) - (*this * amnt); }
Color fade_to_black(uint8_t amnt) { return *this * amnt; }
Color gradient(const Color &to_color, uint8_t amnt) { return (*this * amnt) + (to_color * (255 - amnt)); }
Color lighten(uint8_t delta) { return *this + delta; }
Color darken(uint8_t delta) { return *this - delta; }