col2hcl: convert R color to HCL color matrix

col2hclR Documentation

convert R color to HCL color matrix

Description

convert R color to HCL color matrix

Usage

col2hcl(
  x,
  maxColorValue = 255,
  model = getOption("jam.model", c("hcl", "polarLUV", "polarLAB")),
  ...
)

Arguments

x

R compatible color, either a color name, or hex value, or a mixture of the two. Any value compatible with col2rgb.

model

the color model to use, from "polarLUV" for the standard R conventional HCL, and "polarLAB" which uses the LAB-based HCL values.

...

additional arguments are ignored.

maxValue

numeric maximum value to return, useful when the downstream alpha range should be 255. By default maxValue=1 is returned.

Details

This function takes an R color and converts to an HCL matrix, using the colorspace package, and RGB and polarLUV functions. It is also used to maintain alpha transparency, to enable interconversion via other color manipulation functions as well.

When model="hcl" this function uses farver::decode_colour() and bypasses colorspace. In future the colorspace dependency will likely be removed in favor of using farver. In any event, model="hcl" is equivalent to using model="polarLUV" and fixup=TRUE, except that it should be much faster.

See Also

Other jam color functions: alpha2col(), applyCLrange(), col2alpha(), col2hsl(), col2hsv(), color2gradient(), fixYellowHue(), fixYellow(), getColorRamp(), hcl2col(), hsl2col(), hsv2col(), isColor(), kable_coloring(), makeColorDarker(), make_html_styles(), make_styles(), rgb2col(), setCLranges(), setTextContrastColor(), showColors(), unalpha(), warpRamp()

Examples

col2hcl("#FF000044")


jmw86069/jamba documentation built on Oct. 9, 2024, 10:52 a.m.