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.
shade(x, ...)# S3 method for shade
shade(x, ...)
# S3 method for color
shade(x, ...)
# S3 method for matrix
shade(x, space = "sRGB", alpha = NULL, ...)
# S3 method for character
shade(x, ...)
# S3 method for default
shade(x, ...)
# S3 method for shade
print(x, ...)
# S3 method for shade
[(x, i)
# S3 method for shade
[(x, i) <- value
# S3 method for shade
c(...)
# S3 method for shade
rep(x, ...)
# S3 method for shade
rev(x)
# S3 method for shade
==(x, y)
# S3 method for shade
!=(x, y)
# S3 method for equal.shade
all(target, current, hexonly = FALSE, ...)
R objects, or "shade"
objects for methods.
Additional parameters to methods. For c
, any number of
colours in any acceptable form.
For a matrix, the space in which coordinates are being provided.
For a matrix, an associated vector of opacity values between 0 and 1, if required.
An index vector.
A vector of replacement colours.
Shade vectors to compare.
If TRUE
, compare only on the basis of the hex strings.
Otherwise test for equal coordinates.
A character vector of class "shade"
, with additional
attributes as follows.
A string naming a color space.
A matrix giving colour coordinates in the relevant space, one colour per row.
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.
# NOT RUN {
s <- shade(c("red", "green", "blue"))
s[1]
s[1] <- "pink"
# }
Run the code above in your browser using DataLab