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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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_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; }