Fix yellow color to be less green than default "yellow"
Usage
fixYellow(col, Hrange = c(70, 100), Hshift = -20, fixup = TRUE, ...)Arguments
- col
R color, either in hex color format or using values from
grDevices::colors().- Hrange
numeric vector whose range defines the region of hues to be adjusted. By default hues between 80 and 90 are adjusted. If NULL,
HCLis return unchanged.- Hshift
numeric value length one, used to adjust the hue of colors within the range
Hrange. If NULL,HCLis return unchanged.- fixup
logical, default TRUE, whether to apply fixup to the resulting color, passed tohcl2col()- ...
additional arguments are passed to
col2hcl(), andhcl2col().
Value
returns a vector of R colors the same length as input col.
In the event col, Hrange, or Hshift have length 0, or if any
step in the conversion produces length 0, then the
original col is returned.
Details
This function "fixes" the color yellow, which by default appears green especially when darkened. The effect of this function is to make yellows appear more red, which appears more visibly yellow even when the color is darkened.
This function is intended to be tolerant to missing values. For example if
any of the values col, Hrange, or Hshift are length 0, the original
col is returned unchanged.
See also
Other jam color functions:
alpha2col(),
applyCLrange(),
col2alpha(),
col2hcl(),
col2hsl(),
col2hsv(),
color2gradient(),
fixYellowHue(),
getColorRamp(),
hcl2col(),
hsl2col(),
hsv2col(),
isColor(),
kable_coloring(),
makeColorDarker(),
rainbow2(),
rgb2col(),
setCLranges(),
setTextContrastColor(),
showColors(),
unalpha(),
warpRamp()
Examples
yellows <- vigrep("yellow", grDevices::colors());
fixedYellows <- fixYellow(yellows);
showColors(list(yellows=yellows,
fixedYellows=fixedYellows));