color_brand_sequential | R Documentation |
color_brand_*
functions are wrappers of
interpolate_colors()
for sequential, diverging,
and qualitative brand color palettes. They serve as facilitators for
getting the colors being used in each brand scale.
color_brand_sequential(n, alpha = NULL, direction = 1)
color_brand_diverging(n, alpha = NULL, direction = 1)
color_brand_qualitative(n, alpha = NULL, direction = 1)
n |
This parameter accepts two types of inputs:
|
alpha |
(Optional) A number between |
direction |
(Optional) A number ( |
_brand.yml
brandr
will always look for a _brand.yml
file in the root directory of
your project. If the file is not found, an error message will be displayed.
You can also set the path to the file manually using the
options()
function:
options(BRANDR_BRAND_YML = "PATH_TO_BRAND.YML")
To control the colors for each brand color scale, assign the desired
hexadecimal color codes in a
character
vector to the following options:
BRANDR_COLOR_SEQUENTIAL
: For sequential color scales
BRANDR_COLOR_DIVERGING
: For diverging color scales
BRANDR_COLOR_QUALITATIVE
: For qualitative color scales
You can use get_brand_color()
to get the hexadecimal
color codes from the _brand.yml
file.
Example:
options( BRANDR_COLOR_SEQUENTIAL = get_brand_color(c("primary", "secondary")), BRANDR_COLOR_DIVERGING = get_brand_color(c("primary", "white", "secondary")), BRANDR_COLOR_QUALITATIVE = get_brand_color(c("primary", "secondary", "tertiary")) )
A character
vector with
hexadecimal color codes.
Other color functions:
interpolate_colors()
color_brand_sequential(5)
#> [1] "#390963" "#892B4F" "#DA4E3C" "#EA7220" "#FB9706" # Expected
color_brand_diverging(5)
#> [1] "#390963" "#9C84B1" "#FFFFFF" "#FDCB82" "#FB9706" # Expected
color_brand_qualitative(5)
#> [1] "#DA4E3C" "#390963" "#FB9706" "#DA4E3C" "#390963" # Expected
color_brand_qualitative(3, alpha = 0.5)
#> [1] "#DA4E3C80" "#39096380" "#FB970680" # Expected
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.