1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-18 07:45:56 +00:00

Color mode implementation (#2012)

This commit is contained in:
Oxan van Leeuwen
2021-07-29 19:11:56 +02:00
committed by GitHub
parent de382b704c
commit 5983ccc55c
39 changed files with 1210 additions and 476 deletions

View File

@@ -79,6 +79,15 @@ float gamma_correct(float value, float gamma) {
return powf(value, gamma);
}
float gamma_uncorrect(float value, float gamma) {
if (value <= 0.0f)
return 0.0f;
if (gamma <= 0.0f)
return value;
return powf(value, 1 / gamma);
}
std::string to_lowercase_underscore(std::string s) {
std::transform(s.begin(), s.end(), s.begin(), ::tolower);
std::replace(s.begin(), s.end(), ' ', '_');