mirror of
https://github.com/esphome/esphome.git
synced 2024-11-14 11:08:10 +01:00
add gradient color (#3687)
This commit is contained in:
parent
e2cddf1005
commit
34df7a6072
1 changed files with 1 additions and 0 deletions
|
@ -141,6 +141,7 @@ struct Color {
|
||||||
}
|
}
|
||||||
Color fade_to_white(uint8_t amnt) { return Color(255, 255, 255, 255) - (*this * amnt); }
|
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 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 lighten(uint8_t delta) { return *this + delta; }
|
||||||
Color darken(uint8_t delta) { return *this - delta; }
|
Color darken(uint8_t delta) { return *this - delta; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue