mirror of
https://github.com/Makuna/NeoPixelBus.git
synced 2025-08-07 04:44:26 +02:00
Updated Color objects (markdown)
@@ -1,20 +1,24 @@
|
||||
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.
|
||||
|
||||
# RgbColor object
|
||||
# [RgbColor object](https://github.com/Makuna/NeoPixelBus/blob/V2Beta/src/RgbColor.h)
|
||||
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.
|
||||
|
||||
# RgbwColor object
|
||||
# [RgbwColor object](https://github.com/Makuna/NeoPixelBus/blob/V2Beta/src/RgbwColor.h)
|
||||
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 wit NeoRgbwFeature.
|
||||
The color components are Red, Green, Blue, and White.
|
||||
This can only be used with NeoPixelBus that was declared with a four element color feature like NeoRgbwFeature.
|
||||
|
||||
# HslColor object
|
||||
# [HslColor object](https://github.com/Makuna/NeoPixelBus/blob/V2Beta/src/HslColor.h)
|
||||
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 and set Saturation at 1.0f and Lightness to 0.5f.
|
||||
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);
|
||||
```
|
||||
|
||||
# HsbColor object
|
||||
# [HsbColor object](https://github.com/Makuna/NeoPixelBus/blob/V2Beta/src/HsbColor.h)
|
||||
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.
|
Reference in New Issue
Block a user