Simple colour manipulation in R
NA
s, and will propagate them through manipulations, while NA
s are
accepted as pass-through values when updating colour properties.ggplot2
scales using
the colour manipulation functions in this package (#5, #7). When passed one
of these objects, a modified wrapper object is returned. This allows colour
tweaks to be made to standard scales in ggplot2
plots. See the README for a
visual example.gradient()
function now returns a function if its second argument is
missing or NULL
. This change is complementary to the one above, allowing
palette functions to be created.opacity()
function, which functions just like the other
colour property functions (#4). Opacity (alpha) values are stored as an
attribute with shade objects, and reflected in the RGB hex representation
only when less than 1.scalefac()
functional has been added, which multiplies its argument just
as delta()
adds it. Both functions now accept, and concatenate, multiple
arguments for convenience.recycle()
function, which reverts to a standard R
"recycling" scheme with final dimensions matching the original.dichromat()
function now offers a pass-through (normal colour vision) option, and is also vectorised over its second argument (#3). Some of the coefficients it uses internally are now pre-calculated and cached for efficiency.print
method for vectors of class shade
.shade
vector is now explicitly an error.shades
with ggplot2
(#2), as well as links to several related packages.dichromat()
function can be used to simulate colour blindness.gradient()
function now additionally supports predefined colour maps from
matplotlib and ColorBrewer. Its second argument is now interpreted a little
differently.hueshift()
function has been removed, in favour of the more general
combination of hue()
and delta()
. hue(x, delta(y))
is the equivalent of the
old hueshift(x,y)
, and delta()
can also be used with other colour properties.lightness()
and chroma()
have been added.swatch()
visualisation function plots multidimensional shades in a grid.rev()
method for shades.all.equal()
method for shades now passes on its ellipsis argument when
checking colour coordinates.