ESPHome 2026.8.0
Loading...
Searching...
No Matches
esphome::light::ChannelColors Struct Reference

Which byte of an addressable LED's data carries each colour. More...

#include <channel_colors.h>

Public Member Functions

bool has_white () const
 
uint8_t bytes_per_led () const
 
const char * to_string (char *buf) const
 Write the order back out as text, e.g.
 

Data Fields

uint8_t r
 
uint8_t g
 
uint8_t b
 
uint8_t w
 

Static Public Attributes

static constexpr uint8_t NO_WHITE = 0xFF
 Value of w for a strip that only has red, green and blue channels.
 

Detailed Description

Which byte of an addressable LED's data carries each colour.

Built from a configuration string such as "GRB" or "WRGB": every field holds the position that colour occupies in the bytes the strip expects. w is NO_WHITE when the strip has no separate white channel.

Definition at line 12 of file channel_colors.h.

Member Function Documentation

◆ bytes_per_led()

uint8_t esphome::light::ChannelColors::bytes_per_led ( ) const
inline

Definition at line 23 of file channel_colors.h.

◆ has_white()

bool esphome::light::ChannelColors::has_white ( ) const
inline

Definition at line 21 of file channel_colors.h.

◆ to_string()

const char * esphome::light::ChannelColors::to_string ( char * buf) const
inline

Write the order back out as text, e.g.

"GRBW".

buf must have room for at least 5 characters. Returns buf so the result can be passed straight to a log call.

Definition at line 29 of file channel_colors.h.

Field Documentation

◆ b

uint8_t esphome::light::ChannelColors::b

Definition at line 18 of file channel_colors.h.

◆ g

uint8_t esphome::light::ChannelColors::g

Definition at line 17 of file channel_colors.h.

◆ NO_WHITE

uint8_t esphome::light::ChannelColors::NO_WHITE = 0xFF
staticconstexpr

Value of w for a strip that only has red, green and blue channels.

Definition at line 14 of file channel_colors.h.

◆ r

uint8_t esphome::light::ChannelColors::r

Definition at line 16 of file channel_colors.h.

◆ w

uint8_t esphome::light::ChannelColors::w

Definition at line 19 of file channel_colors.h.


The documentation for this struct was generated from the following file: