Kelvin
Color Temperature
This is a one-way approximation. There is no .to('kelvin')
method option.
This method uses trapezoid integration to sum the wavelength distribution of energy through a black body tensor.
While an approximation, it is a rather accurate one, and based on real-world black-body radiation measurements.
Temperatures above 10,000°K may be less accurate, but the method allows for temperatures up to 40,000°K.
New Color
Color.from('kelvin', degrees: number)
Color.from('temperature', degrees: number)
Get methods
.getK(): number
.getKelvin(): number // alias
Example Output
rgb: {
r: 255,
g: 13,
b: 0,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 38,
b: 0,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 58,
b: 0,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 76,
b: 0,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 93,
b: 0,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 108,
b: 0,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 122,
b: 0,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 135,
b: 0,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 147,
b: 0,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 159,
b: 0,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 169,
b: 7,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 179,
b: 17,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 187,
b: 25,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 196,
b: 34,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 203,
b: 43,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 210,
b: 52,
a: 255,
bitDepth: 8
}
rgb: {
r: 255,
g: 210,
b: 52,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 217,
b: 60,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 223,
b: 69,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 228,
b: 78,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 234,
b: 87,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 238,
b: 95,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 243,
b: 104,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 247,
b: 112,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 251,
b: 120,
a: 255,
bitDepth: 8
}rgb: {
r: 255,
g: 254,
b: 128,
a: 255,
bitDepth: 8
}rgb: {
r: 254,
g: 255,
b: 137,
a: 255,
bitDepth: 8
}rgb: {
r: 251,
g: 255,
b: 144,
a: 255,
bitDepth: 8
}rgb: {
r: 248,
g: 255,
b: 152,
a: 255,
bitDepth: 8
}rgb: {
r: 246,
g: 255,
b: 160,
a: 255,
bitDepth: 8
}rgb: {
r: 243,
g: 255,
b: 167,
a: 255,
bitDepth: 8
}rgb: {
r: 240,
g: 255,
b: 174,
a: 255,
bitDepth: 8
}
rgb: {
r: 240,
g: 255,
b: 174,
a: 255,
bitDepth: 8
}rgb: {
r: 238,
g: 255,
b: 182,
a: 255,
bitDepth: 8
}rgb: {
r: 235,
g: 255,
b: 189,
a: 255,
bitDepth: 8
}rgb: {
r: 233,
g: 255,
b: 195,
a: 255,
bitDepth: 8
}rgb: {
r: 230,
g: 255,
b: 201,
a: 255,
bitDepth: 8
}rgb: {
r: 227,
g: 255,
b: 207,
a: 255,
bitDepth: 8
}rgb: {
r: 225,
g: 255,
b: 213,
a: 255,
bitDepth: 8
}rgb: {
r: 222,
g: 255,
b: 219,
a: 255,
bitDepth: 8
}rgb: {
r: 220,
g: 255,
b: 224,
a: 255,
bitDepth: 8
}rgb: {
r: 217,
g: 255,
b: 230,
a: 255,
bitDepth: 8
}rgb: {
r: 215,
g: 255,
b: 235,
a: 255,
bitDepth: 8
}rgb: {
r: 213,
g: 255,
b: 240,
a: 255,
bitDepth: 8
}rgb: {
r: 211,
g: 255,
b: 245,
a: 255,
bitDepth: 8
}rgb: {
r: 209,
g: 255,
b: 250,
a: 255,
bitDepth: 8
}rgb: {
r: 208,
g: 255,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 206,
g: 255,
b: 255,
a: 255,
bitDepth: 8
}
rgb: {
r: 206,
g: 255,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 204,
g: 255,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 203,
g: 255,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 199,
g: 255,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 195,
g: 255,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 192,
g: 255,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 188,
g: 255,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 184,
g: 255,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 181,
g: 255,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 178,
g: 255,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 175,
g: 255,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 172,
g: 255,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 170,
g: 255,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 167,
g: 255,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 164,
g: 252,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 162,
g: 250,
b: 255,
a: 255,
bitDepth: 8
}
rgb: {
r: 162,
g: 250,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 160,
g: 248,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 158,
g: 246,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 156,
g: 244,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 154,
g: 242,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 152,
g: 241,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 150,
g: 239,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 148,
g: 237,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 147,
g: 235,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 145,
g: 234,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 143,
g: 232,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 142,
g: 231,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 140,
g: 230,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 139,
g: 228,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 138,
g: 227,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 136,
g: 225,
b: 255,
a: 255,
bitDepth: 8
}
rgb: {
r: 136,
g: 225,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 135,
g: 224,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 134,
g: 223,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 133,
g: 222,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 132,
g: 221,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 130,
g: 220,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 129,
g: 218,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 128,
g: 217,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 127,
g: 216,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 126,
g: 215,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 126,
g: 214,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 125,
g: 213,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 124,
g: 213,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 123,
g: 212,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 122,
g: 211,
b: 255,
a: 255,
bitDepth: 8
}rgb: {
r: 121,
g: 210,
b: 255,
a: 255,
bitDepth: 8
}
JavaScript
const Color = require('chromaticity-color-utilities')
const color1 = Color.from('kelvin',1000).to('rgb')
// rgb { r: 255, g: 13, b: 0, a: 255, bitDepth: 8, max: 255 }
const color1 = Color.from('kelvin',2000).to('rgb')
// rgb { r: 255, g: 169, b: 7, a: 255, bitDepth: 8, max: 255 }
const color1 = Color.from('kelvin',4000).to('rgb')
// rgb { r: 240, g: 255, b: 174, a: 255, bitDepth: 8, max: 255 }
const color1 = Color.from('kelvin',8000).to('rgb')
// rgb { r: 143, g: 232, b: 255, a: 255, bitDepth: 8, max: 255 }
const color1 = Color.from('kelvin',10000).to('rgb')
// rgb { r: 121, g: 210, b: 255, a: 255, bitDepth: 8, max: 255 }
TypeScript
import Color from 'chromaticity-color-utilities'
const c: Color.kelvin = Color.from('kelvin',1000)