Update esphome/components/light/light_color_values.h

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
J. Nick Koston
2026-03-20 22:06:11 -10:00
committed by GitHub
co-authored by Copilot
parent 4d805e2d30
commit 4ae1043c2e
@@ -155,12 +155,15 @@ class LightColorValues {
/// Convert these light color values to an CWWW representation with the given parameters.
///
/// Note on gamma and constant_brightness: This method operates on raw (linear) channel
/// values. For constant_brightness=false, gamma can be applied after this method since
/// gamma commutes with simple multiplication. For constant_brightness=true, the caller
/// (LightState::current_values_as_cwww) must apply gamma to the individual channel values
/// BEFORE the balancing formula, because the nonlinear max/sum ratio does not commute
/// with gamma. See LightState::current_values_as_cwww() for the correct implementation.
/// Note on gamma and constant_brightness: This method operates on the raw/internal channel
/// values stored in this object. For cold_white_ and warm_white_ specifically, these
/// may already be gamma-uncorrected when derived from a color_temperature value.
/// For constant_brightness=false, additional gamma for the output can be applied after
/// this method since gamma commutes with simple multiplication. For constant_brightness=true,
/// the caller (LightState::current_values_as_cwww) must apply gamma to the individual
/// channel values BEFORE the balancing formula, because the nonlinear max/sum ratio does
/// not commute with gamma. See LightState::current_values_as_cwww() for the correct
/// implementation.
void as_cwww(float *cold_white, float *warm_white, bool constant_brightness = false) const {
if (this->color_mode_ & ColorCapability::COLD_WARM_WHITE) {
const float cw_level = this->cold_white_;