Skip to contents

[Maturing]

get_brand_color() retrieves color codes from the _brand.yml file.

Usage

get_brand_color(color, alpha = NULL)

Arguments

color

A character vector indicating the name of colors present in the color section of the _brand.yml file.

alpha

(Optional) A number between 0 and 1, indicating the transparency of the colors (Default: NULL).

Value

A character vector with hexadecimal color codes.

Details

Path to _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")

See also

Examples

get_brand_color("primary")
#> [1] "#DA4E3C"
#> [1] "#DA4E3C" # Expected

get_brand_color("secondary")
#> [1] "#390963"
#> [1] "#390963" # Expected

get_brand_color("tertiary")
#> [1] "#FB9706"
#> [1] "#FB9706" # Expected

get_brand_color("tertiary", alpha = 0.5)
#> [1] "#FB970680"
#> [1] "#FB970680" # Expected

get_brand_color(c("primary", "secondary"))
#> [1] "#DA4E3C" "#390963"
#> [1] "#DA4E3C" "#390963" # Expected

get_brand_color(c("red", "purple", "orange"))
#> [1] "#DA4E3C" "#390963" "#F06F20"
#> [1] "#DA4E3C" "#390963" "#F06F20" # Expected