ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
color_helpers.h
Go to the documentation of this file.
1#pragma once
2#include <cstdint>
3
5
6namespace esphome::as734x {
7
8// Smallest tristimulus sum that still carries a usable hue.
9constexpr float MIN_TRISTIMULUS_SUM = 0.001f;
10
11// Correlated colour temperature in kelvin from CIE 1931 tristimulus values, using McCamy's
12// approximation. Returns NAN when the input carries no usable hue, or when the result falls
13// outside the range the approximation holds over.
14float tristimulus_to_cct(float x, float y, float z);
15
16#ifdef USE_AS734X_RGB
17// sRGB components for CIE 1931 tristimulus values. Pass chromaticity (x + y + z == 1) rather than
18// absolute values, otherwise anything but dim light clamps to white.
19void tristimulus_to_rgb(float x, float y, float z, uint8_t &r, uint8_t &g, uint8_t &b);
20#endif
21
22} // namespace esphome::as734x
bool z
Definition msa3xx.h:1
void tristimulus_to_rgb(float x, float y, float z, uint8_t &r, uint8_t &g, uint8_t &b)
float tristimulus_to_cct(float x, float y, float z)
constexpr float MIN_TRISTIMULUS_SUM
uint16_t x
Definition tt21100.cpp:5
uint16_t y
Definition tt21100.cpp:6