manip_channel | R Documentation |
This set of functions allows you to modify colours as given by strings, whithout first decoding them. For large vectors of colour values this should provide a considerable speedup.
set_channel( colour, channel, value, space = "rgb", white = "D65", na_value = NA ) add_to_channel( colour, channel, value, space = "rgb", white = "D65", na_value = NA ) multiply_channel( colour, channel, value, space = "rgb", white = "D65", na_value = NA ) raise_channel( colour, channel, value, space = "rgb", white = "D65", na_value = NA ) cap_channel( colour, channel, value, space = "rgb", white = "D65", na_value = NA ) get_channel(colour, channel, space = "rgb", white = "D65", na_value = NA)
colour |
A character string giving colours, either as hexadecimal strings or accepted colour names. |
channel |
The channel to modify or extract as a single letter, or
|
value |
The value to modify with |
space |
The colour space the channel pertains to. Allowed values are:
|
white |
The white reference of the channel colour space. Will only have
an effect for relative colour spaces such as Lab and luv. Any value accepted
by |
na_value |
A valid colour string or |
A character vector of the same length as colour
(or a numeric
vector in the case of get_channel()
)
Other encoding and decoding functions:
decode_colour()
,
encode_colour()
spectrum <- rainbow(10) # set a specific channel set_channel(spectrum, 'r', c(10, 50)) set_channel(spectrum, 'l', 50, space = 'lab') set_channel(spectrum, 'alpha', c(0.5, 1)) # Add value to channel add_to_channel(spectrum, 'r', c(10, 50)) add_to_channel(spectrum, 'l', 50, space = 'lab') # Multiply a channel multiply_channel(spectrum, 'r', c(10, 50)) multiply_channel(spectrum, 'l', 50, space = 'lab') # set a lower bound on a channel raise_channel(spectrum, 'r', c(10, 50)) raise_channel(spectrum, 'l', 20, space = 'lab') # set an upper bound on a channel cap_channel(spectrum, 'r', c(100, 50)) cap_channel(spectrum, 'l', 20, space = 'lab')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.