View source: R/interpolate_colors.R
interpolate_colors | R Documentation |
interpolate_colors()
interpolate colors for sequential, diverging,
and qualitative color scales.
interpolate_colors(
n,
colors = getOption("BRANDR_COLOR_SEQUENTIAL"),
type = "seq",
alpha = NULL,
direction = 1,
...
)
n |
This parameter accepts two types of inputs:
|
colors |
(Optional) A |
type |
(Optional) A |
alpha |
(Optional) A number between |
direction |
(Optional) A number ( |
... |
Additional arguments passed to
|
A character
vector with
hexadecimal color codes.
Other color functions:
color_brand_sequential()
interpolate_colors(3, colors = c("red", "blue"), type = "seq")
#> [1] "#FF0000" "#7F007F" "#0000FF" # Expected
interpolate_colors(3, colors = c("red", "blue"), direction = -1)
#> [1] "#0000FF" "#7F007F" "#FF0000" # Expected
interpolate_colors(3, colors = c("red", "blue"), alpha = 0.5)
#> [1] "#FF000080" "#7F007F80" "#0000FF80" # Expected
# `type = "seq"` and `type = "div"` produce the same result
interpolate_colors(3, colors = c("red", "white", "blue"), type = "div")
#> [1] "#FF0000" "#FFFFFF" "#0000FF" # Expected
interpolate_colors(3, colors = c("red", "blue"), type = "qual")
#> [1] "#FF0000" "#0000FF" "#FF0000" # Expected
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.