From f084ab339bb1381ebffb86d2b409dc5aa57f7ea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20T=C3=B6lke?= Date: Fri, 22 Jan 2021 08:55:49 +0100 Subject: [PATCH] Make fade_to*, lighten, and darken const (#1450) --- esphome/components/light/addressable_light.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/esphome/components/light/addressable_light.h b/esphome/components/light/addressable_light.h index a95d70f274..4e7ec4b931 100644 --- a/esphome/components/light/addressable_light.h +++ b/esphome/components/light/addressable_light.h @@ -149,10 +149,10 @@ struct ESPColor { return ESPColor(uint8_t((uint16_t(r) * 255U / max_rgb)), uint8_t((uint16_t(g) * 255U / max_rgb)), uint8_t((uint16_t(b) * 255U / max_rgb)), w); } - ESPColor fade_to_white(uint8_t amnt) { return ESPColor(255, 255, 255, 255) - (*this * amnt); } - ESPColor fade_to_black(uint8_t amnt) { return *this * amnt; } - ESPColor lighten(uint8_t delta) { return *this + delta; } - ESPColor darken(uint8_t delta) { return *this - delta; } + ESPColor fade_to_white(uint8_t amnt) const { return ESPColor(255, 255, 255, 255) - (*this * amnt); } + ESPColor fade_to_black(uint8_t amnt) const { return *this * amnt; } + ESPColor lighten(uint8_t delta) const { return *this + delta; } + ESPColor darken(uint8_t delta) const { return *this - delta; } static const ESPColor BLACK; static const ESPColor WHITE;