ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
esphome::display::ColorUtil Class Reference

#include <display_color_utils.h>

Public Member Functions

 ESPDEPRECATED ("Packed colors are always RGB, drop the ColorOrder argument. Removed in 2027.5.0", "2026.11.0") static Color to_color(uint32_t colorcode
 

Static Public Member Functions

template<ColorBitness BITNESS>
static ESPHOME_ALWAYS_INLINE uint32_t read_packed (const uint8_t *ptr, size_t index, bool big_endian)
 Reads one packed pixel of the given bitness from a source buffer into the value to_color() takes.
 
static Color to_color (uint32_t colorcode, ColorBitness color_bitness=ColorBitness::COLOR_BITNESS_888, bool right_bit_aligned=true)
 Unpacks a color of the given bitness, red in the most significant bits.
 

Data Fields

ColorOrder color_order
 
ColorOrder ColorBitness color_bitness = ColorBitness::COLOR_BITNESS_888
 

Detailed Description

Definition at line 44 of file display_color_utils.h.

Member Function Documentation

◆ ESPDEPRECATED()

esphome::display::ColorUtil::ESPDEPRECATED ( "Packed colors are always RGB,
drop the ColorOrder argument. Removed in 2027.5.0" ,
"2026.11.0"  )

◆ read_packed()

template<ColorBitness BITNESS>
static ESPHOME_ALWAYS_INLINE uint32_t esphome::display::ColorUtil::read_packed ( const uint8_t * ptr,
size_t index,
bool big_endian )
inlinestatic

Reads one packed pixel of the given bitness from a source buffer into the value to_color() takes.

BITNESS is a template argument so the byte layout folds; pass it on to to_color() as a constant too, and its channel scaling divides by a constant, which the compiler turns into a multiply and shift.

Definition at line 51 of file display_color_utils.h.

◆ to_color()

static Color esphome::display::ColorUtil::to_color ( uint32_t colorcode,
ColorBitness color_bitness = ColorBitness::COLOR_BITNESS_888,
bool right_bit_aligned = true )
inlinestatic

Unpacks a color of the given bitness, red in the most significant bits.

Definition at line 67 of file display_color_utils.h.

Field Documentation

◆ color_bitness

ColorOrder ColorBitness esphome::display::ColorUtil::color_bitness = ColorBitness::COLOR_BITNESS_888

Definition at line 108 of file display_color_utils.h.

◆ color_order

ColorOrder esphome::display::ColorUtil::color_order

Definition at line 107 of file display_color_utils.h.


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