shade {shades} | R Documentation |
The shade class
Description
Objects of class "shade"
are simply standard R character vectors
representing one or more 8-bit (s)RGB colours in CSS-like hex format, but
with extra attributes giving the current colour space and coordinates.
Usage
shade(x, ...)
## S3 method for class 'shade'
shade(x, ...)
## S3 method for class 'color'
shade(x, ...)
## S3 method for class 'matrix'
shade(x, space = "sRGB", alpha = NULL, ...)
## S3 method for class 'character'
shade(x, ...)
## Default S3 method:
shade(x, ...)
## S3 method for class 'shade'
print(x, ...)
## S3 method for class 'shade'
x[i]
## S3 replacement method for class 'shade'
x[i] <- value
## S3 method for class 'shade'
c(...)
## S3 method for class 'shade'
rep(x, ...)
## S3 method for class 'shade'
rev(x)
## S3 method for class 'shade'
x == y
## S3 method for class 'shade'
x != y
## S3 method for class 'equal.shade'
all(target, current, hexonly = FALSE, ...)
Arguments
x , y |
R objects, or |
... |
Additional parameters to methods. For |
space |
For a matrix, the space in which coordinates are being provided. |
alpha |
For a matrix, an associated vector of opacity values between 0 and 1, if required. |
i |
An index vector. |
value |
A vector of replacement colours. |
target , current |
Shade vectors to compare. |
hexonly |
If |
Details
Comparison between "shade"
objects x
and y
is achieved
by converting y
(the second argument) into the colour space of
x
and then comparing coordinates, after any clipping.
Value
A character vector of class "shade"
, with additional
attributes as follows.
space |
A string naming a color space. |
coords |
A matrix giving colour coordinates in the relevant space, one colour per row. |
Note
When concatenating, shades that are all from the same space will remain in that space, but shades from different spaces will be warped to “XYZ” space.
Author(s)
Jon Clayden <code@clayden.org>
Examples
s <- shade(c("red", "green", "blue"))
s[1]
s[1] <- "pink"