temperature: Color Temperature Specification

View source: R/parse_temperature.R

temperatureR Documentation

Color Temperature Specification

Description

Converts color temperature in Kelvin to a color vector.

Usage

temperature(x = 5200)

Arguments

x

light temperature in Kelvin, a numeric vector with values in [1000, 40000]. 1000 is candle light, 2000 is sunset light, 3200 is a tungsten light bulb, 4000 is a white fluorescent light tube, 5200 is average midday sunlight, 7000 is overcast daylight, 10000 is the color of a clear blue sky.

Value

A vector of colors specified as hex codes

See Also

parse_color for the general function to parse colors in various specifications (which this function calls internally) and convert_color to convert parsed colors to another model.

Other color specifications: cmyk(), css(), hcl(), hex(), hsi(), hsl(), hsv(), lab(), parse_color(), rgb(), ryb(), wavelength()

Examples

temperature()
temperature(c(2000, 5200, 7000))

# Display a large range of color temperatures
x <- seq(1000, 15000, length.out=200)
notable_temperatures <- c(1000, 2000, 3200, 4000, 5200, 7000, 10000)
plot(x=x, y=rep(0, 200), col=temperature(x), pch="|", cex=5, xaxt='n')
axis(side=1, at=notable_temperatures, labels=TRUE, las=2)
abline(v=notable_temperatures, lty="dotted")

jiho/chroma documentation built on Nov. 26, 2022, 2:39 a.m.