1111
1212# Kelvin2RGB
1313
14- Arduino library for converting temperature and brightness to RGB values.
14+ Arduino library for converting Kelvin temperature and brightness to RGB values.
1515
1616
1717## Credentials
@@ -62,20 +62,20 @@ Especially with images with more than 8 bits per channel this is preferred.
6262That said it is also possible to use this on a 565 image or to adjust colour lookup tables.
6363
6464
65- #### Celsius and Fahrenheit
65+ ### Celsius and Fahrenheit
6666
6767To use Celsius or Fahrenheit with the ** Kelvin2RGB** library,
6868one need to convert that temperature to Kelvin.
6969
7070``` cpp
7171Kelvin = Celsius + 273.15 ;
72- Kelvin = (Fahrenheit - 32 ) * 5 / 9 - 273.15 ;
72+ Kelvin = (Fahrenheit - 32 ) * 5.0 / 9.0 - 273.15 ;
7373// or shorter
7474Kelvin = (Fahrenheit - 523.67 ) * 0.5555555555 ;
7575```
7676
7777
78- #### Related
78+ ### Related
7979
8080- https://github.com/RobTillaart/Kelvin2RGB
8181- https://github.com/RobTillaart/map2colour map float onto a colour(gradient).
@@ -90,14 +90,14 @@ Kelvin = (Fahrenheit - 523.67) * 0.5555555555;
9090
9191The interface is straightforward:
9292
93- #### Constructor
93+ ### Constructor
9494
9595- ** Kelvin2RGB()** constructor.
9696- ** void begin()** resets all internal values to 0.
9797 All colours, brightness and temperature.
9898
9999
100- #### Convertors
100+ ### Convertors
101101
102102- ** void convert_TH(float temperature, float brightness = 100)**
103103 temperature = 0..65500 temperature below 1000 is not well defined.
@@ -114,7 +114,7 @@ The interface is straightforward:
114114- ** float blue()** returns blue channel weight 0.0 .. 1.0
115115
116116
117- #### Color types
117+ ### Color types
118118
119119- ** uint32_t setRGB(float red, float green, float blue, float brightness = 100)** sets RGB values
120120 red, green, blue should be in 0 .. 1.0 range. brightness should be in 0..100%, Default = 100%.
@@ -126,14 +126,41 @@ The interface is straightforward:
126126- ** uint32_t CMYK()** returns a 32 bit = 4 byte CMYK value,
127127
128128
129- #### Obsolete
129+ ### Obsolete
130130
131131- ** void reset()** => replaced by ** begin()**
132132
133133
134134## Predefined colors
135135
136136
137+ ``` cpp
138+ const uint16_t DLS_dark = 0 ;
139+ const uint16_t DLS_match = 1700 ;
140+ const uint16_t DLS_sodiumLamp = 1700 ;
141+ const uint16_t DLS_candleFlame = 1850 ;
142+ const uint16_t DLS_sunrise = 1850 ;
143+ const uint16_t DLS_sunset = 1850 ;
144+ const uint16_t DLS_bulb = 2400 ;
145+ const uint16_t DLS_bulbSoftWhite = 2550 ;
146+ const uint16_t DLS_LEDlamp = 2700 ;
147+ const uint16_t DLS_warmWhite = 3000 ;
148+ const uint16_t DLS_studioLight = 3200 ;
149+ const uint16_t DLS_studioCPlight = 3350 ;
150+ const uint16_t DLS_daylightHorizon = 5000 ;
151+ const uint16_t DLS_flashLight = 5700 ;
152+ const uint16_t DLS_xenonLight = 6200 ;
153+ const uint16_t DLS_dayLightBright = 6500 ;
154+ const uint16_t DLS_normal = 6500 ;
155+ const uint16_t DLS_screenLow = 6500 ;
156+ const uint16_t DLS_screenMed = 8000 ;
157+ const uint16_t DLS_screenHigh = 9500 ;
158+ const uint16_t DLS_polewardSky0 = 15000 ;
159+ const uint16_t DLS_polewardSky1 = 19000 ;
160+ const uint16_t DLS_polewardSky2 = 23000 ;
161+ const uint16_t DLS_polewardSky3 = 27000 ;
162+ ```
163+
137164
138165## Future
139166
@@ -149,7 +176,6 @@ The interface is straightforward:
149176- investigate other formulas.
150177- investigate usability for RGB led strip.
151178- separate brightness per colour channel to mimic "artificial illumination"
152- - remove begin() or reset()?
153179- add examples
154180 - ledstrip
155181- use a "dirty flag" to minimize math operations.
0 commit comments