ESPHome 2025.5.2
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
color_mode.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4
5namespace esphome {
6namespace light {
7
9enum class ColorCapability : uint8_t {
11 ON_OFF = 1 << 0,
13 BRIGHTNESS = 1 << 1,
15 WHITE = 1 << 2,
17 COLOR_TEMPERATURE = 1 << 3,
19 COLD_WARM_WHITE = 1 << 4,
21 RGB = 1 << 5
22};
23
26 public:
28 constexpr operator ColorCapability() const { return val_; }
29 constexpr operator uint8_t() const { return static_cast<uint8_t>(val_); }
30 constexpr operator bool() const { return static_cast<uint8_t>(val_) != 0; }
31
32 protected:
34};
36 return static_cast<ColorCapability>(static_cast<uint8_t>(lhs) & static_cast<uint8_t>(rhs));
37}
39 return static_cast<ColorCapability>(static_cast<uint8_t>(lhs) & static_cast<uint8_t>(rhs));
40}
42 return static_cast<ColorCapability>(static_cast<uint8_t>(lhs) | static_cast<uint8_t>(rhs));
43}
45 return static_cast<ColorCapability>(static_cast<uint8_t>(lhs) | static_cast<uint8_t>(rhs));
46}
47
76
79 public:
81 constexpr operator ColorMode() const { return val_; }
82 constexpr operator uint8_t() const { return static_cast<uint8_t>(val_); }
83 constexpr operator bool() const { return static_cast<uint8_t>(val_) != 0; }
84
85 protected:
87};
89 return static_cast<ColorMode>(static_cast<uint8_t>(lhs) & static_cast<uint8_t>(rhs));
90}
92 return static_cast<ColorMode>(static_cast<uint8_t>(lhs) & static_cast<uint8_t>(rhs));
93}
95 return static_cast<ColorMode>(static_cast<uint8_t>(lhs) & static_cast<uint8_t>(rhs));
96}
98 return static_cast<ColorMode>(static_cast<uint8_t>(lhs) | static_cast<uint8_t>(rhs));
99}
101 return static_cast<ColorMode>(static_cast<uint8_t>(lhs) | static_cast<uint8_t>(rhs));
102}
104 return static_cast<ColorMode>(static_cast<uint8_t>(lhs) | static_cast<uint8_t>(rhs));
105}
106
107} // namespace light
108} // namespace esphome
Helper class to allow bitwise operations on ColorCapability.
Definition color_mode.h:25
constexpr ColorCapabilityHelper(ColorCapability val)
Definition color_mode.h:27
Helper class to allow bitwise operations on ColorMode with ColorCapability.
Definition color_mode.h:78
constexpr ColorModeHelper(ColorMode val)
Definition color_mode.h:80
mopeka_std_values val[4]
constexpr ColorCapabilityHelper operator|(ColorCapability lhs, ColorCapability rhs)
Definition color_mode.h:41
constexpr ColorCapabilityHelper operator&(ColorCapability lhs, ColorCapability rhs)
Definition color_mode.h:35
ColorMode
Color modes are a combination of color capabilities that can be used at the same time.
Definition color_mode.h:49
@ RGB_COLD_WARM_WHITE
RGB color output, and separate cold and warm white outputs.
@ UNKNOWN
No color mode configured (cannot be a supported mode, only active when light is off).
@ RGB_WHITE
RGB color output and a separate white output.
@ RGB_COLOR_TEMPERATURE
RGB color output and a separate white output with controllable color temperature.
ColorCapability
Color capabilities are the various outputs that a light has and that can be independently controlled ...
Definition color_mode.h:9
@ ON_OFF
Light can be turned on/off.
@ BRIGHTNESS
Master brightness of the light can be controlled.
@ RGB
Color can be controlled using RGB format (includes a brightness control for the color).
@ COLOR_TEMPERATURE
Color temperature can be controlled.
@ WHITE
Brightness of white channel can be controlled separately from other channels.
@ COLD_WARM_WHITE
Brightness of cold and warm white output can be controlled.
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7