seq_color | R Documentation |
Interpolate (non-linearly) between two colors
seq_color(
col1,
col2,
n = 100,
type = "cubic",
direction = "in-out",
colorspace = "hcl"
)
col1 , col2 |
the two colors to interpolate between |
n |
Number of steps for the transition (including the endpoints) |
type |
Type of motion easing. Default: 'cubic'. Valid values are are 'sine', 'quad', 'cubic', 'quart', 'quint', 'exp', 'circle', 'back', 'elastic', 'linear'. |
direction |
When should the easing apply? Default: "in-out". Valid values are 'in', 'out', in-out'. Default: 'in-out' |
colorspace |
Color space in which to do the interpolation. Default: 'hcl'
Can be any colorspace understood by the |
character vector containing a color sequence
n <- 20
cols <- seq_color('red', 'blue', n = n, direction = 'in-out', colorspace = 'hcl')
cols
grid::grid.rect(x = seq(0, 0.95, length.out = n), width = 0.1,
gp = grid::gpar(fill = cols, col = NA))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.