setCLranges | R Documentation |
Return Crange, Lrange, Cgrey, adjustRgb values for the given lightMode, intended to provide ranges suitable for contrasting text displayed on a light or dark background.
setCLranges(
lightMode = NULL,
Crange = getOption("jam.Crange"),
Lrange = getOption("jam.Lrange"),
Cgrey = getOption("jam.Cgrey", 5),
adjustRgb = getOption("jam.adjustRgb", 0),
setOptions = c("FALSE", "ifnull", "TRUE"),
verbose = FALSE,
...
)
lightMode |
boolean indicating whether the background color
is light (TRUE is bright), or dark (FALSE is dark.) By default
it calls |
Crange |
numeric range of chroma values, ranging
between 0 and 100. By default, |
Lrange |
numeric range of luminance values, ranging
between 0 and 100. By default, |
Cgrey |
numeric chroma (C) value, which defines grey colors at or
below this chroma. Any colors at or below the grey cutoff will have
their C values unchanged. This mechanism prevents converting black
to red, for example. To disable the effect, set |
adjustRgb |
numeric color adjustment factor, used during the
conversion of RGB colors to the ANSI-compatible colors used
by the |
setOptions |
character or logical whether to update
|
verbose |
|
... |
additional arguments are ignored. |
This function is intended mainly for internal use by jamba
such as printDebug()
, and make_styles()
, which is also mainly
intended for console text or other printed text output.
The utility of this function is to store the logic of determining
sensible default ranges.
Companion functions:
applyCLranges()
is used to apply the ranges to a vector of R colors.
checkLightMode()
is used to detect whether console output is expected
to have a light or dark background.
list
with elements:
Numeric vector of length 2, defining the HCL chroma (C) range.
Numeric vector of length 2, defining the HCL luminance (L) range.
Numeric vector of length 1, defining the adjustment to apply during RGB-to-ANSI color conversion.
Numeric vector of length 1, defining the
HCL chroma (C) value below which colors are considered greyscale,
and are converted to ANSI greyscale colors.
HCL chroma ranges from 0 to 100. Set value Cgrey=-1
or
Cgrey=FALSE
to disable this logic, causing colors to be
matched using all available ANSI color values.
Other jam color functions:
alpha2col()
,
applyCLrange()
,
col2alpha()
,
col2hcl()
,
col2hsl()
,
col2hsv()
,
color2gradient()
,
fixYellowHue()
,
fixYellow()
,
getColorRamp()
,
hcl2col()
,
hsl2col()
,
hsv2col()
,
isColor()
,
kable_coloring()
,
makeColorDarker()
,
make_html_styles()
,
make_styles()
,
rgb2col()
,
setTextContrastColor()
,
showColors()
,
unalpha()
,
warpRamp()
setCLranges(lightMode=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.