Skip to content
Michael Miller edited this page Jan 19, 2024 · 11 revisions

There are several color objects that can be used to define and blend colors. While all can be directly used to set the pixel color, the RgbwColor can only be used with a NeoPixelBus that has been declared with NeoRgbwFeature or a compile error will be given.

This represents a color as RGB model and exposes useful methods to manipulate colors. This is the native color used and is the most efficient.
The color components are Red, Green, and Blue each with 8 bits of precision. With a total of 24 bits.

This represents a color as RGBW model and exposes useful methods to manipulate colors. This is the native color used and is the most efficient with a NeoPixelBus defined with NeoRgbwFeature.
The color components are Red, Green, Blue, and White each with 8 bits of precision. With a total of 32 bits.
This can only be used with NeoPixelBus that was declared with a four element color feature like NeoRgbwFeature.

This represents a color as RGBWW model and exposes useful methods to manipulate colors. This is the native color used and is the most efficient with a NeoPixelBus defined with NeoGrbcwxFeature.
The color components are Red, Green, Blue, Warmer White, and Cooler White each with 8 bits of precision. With a total of 40 bits.
This can only be used with NeoPixelBus that was declared with a six element (one unused) color feature like NeoGrbcwxFeature.

This represents a color as RGBWWW model and exposes useful methods to manipulate colors. This is the native color used and is the most efficient with a NeoPixelBus defined with NeoGrbwwwFeature.
The color components are Red, Green, Blue, White 1, White 2, and White 3; each with 8 bits of precision. With a total of 48 bits.
This can only be used with NeoPixelBus that was declared with a six element color feature like NeoGrbwwwFeature.

This represents a color as RGB 565 model and exposes useful methods to manipulate colors. It uses a single uint16_t to store the color.
The color components are Red, Green, and Blue. 5 bits for red, 6 bits for green, and 5 bits for blue. With a total of 16 bits.

This represents a color as RGB model and exposes useful methods to manipulate colors. This is the native color used with some color features where the pixel supports 16bit precision.
The color components are Red, Green, and Blue each with 16 bits of precision. With a total of 48 bits.

This represents a color as RGBW model and exposes useful methods to manipulate colors. This is the native color used with some color features where the pixel supports 16bit precision with a white channel.
The color components are Red, Green, Blue, and White each with 16 bits of precision. With a total of 64 bits.
This can only be used with NeoPixelBus that was declared with a four element 16 bit color feature like NeoRgbwUcs8904Feature.

This represents a color as a single uint32_t and exposes minimal methods to convert colors. This is primarily used to convert standard Html color value to other color objects and back.
The value is commonly represented in hexadecimal (ex. 0xff7f00). It is coded as three bytes, the left most being red (0xff), the middle being green (0x7f), and the right most being blue (0x00).

This represents a color as a HSL model and exposes useful methods to manipulate colors. While not the native color used, the extra overhead will be offset by intuitive color components and effects.
The color components are Hue, Saturation, and Lightness, all in the range of 0.0 to 1.0.
To darken the color, just reduce the L property. To brighten the color, just increase the L property. A normal range for L is from 0.0f to 0.5f when Saturation is set to 1.0f.
To randomly pick a full bright color, just randomly pick a Hue (0.0-1.0) and set Saturation at 1.0f and Lightness to 0.5f.
Note: There are many examples of HSL that demonstrate Hue component having a valid range of 0.0 - 360.0. This library supports only 0.0 - 1.0, to convert, just divide the value you have by 360 and pass it in like below.

   HslColor color(hueValue / 360.0f, saturationValue, lightnessValue); 

This represents a color as a HSB (aka HSV) model and exposes useful methods to manipulate colors. While not the native color used, the extra overhead will be offset by intuitive color components and effects.
This is included for completeness for those who are given code that uses this older format.

This represents a color as a Seven Segment Digit model and exposes useful methods to manipulate segments and brightness to form numbers and letters. This is the native color used with the seven segment color features like NeoAbcdefgpsSegmentFeature.
The color components are the standard seven segment designator labels, A, B, C, D, E, F, G, period, and special each with 8 bits of brightness. With a total of 72 bits.

Clone this wiki locally