Learn R Programming

brand.yml (version 0.1.0)

theme_brand_flextable: Create a flextable theme using brand colors

Description

Apply brand colors to a flextable table.

Usage

theme_brand_flextable(
  table,
  brand = NULL,
  background = NULL,
  foreground = NULL
)

Value

Returns a themed flextable object.

Arguments

table

A flextable object to theme.

brand

One of:

  • NULL (default): Automatically detect and read a _brand.yml file

  • A path to a brand.yml file or directory containing _brand.yml

  • A brand object (as returned by read_brand_yml() or as_brand_yml())

  • FALSE: Don't use a brand file; explicit colors must be provided

background

The background color, defaults to brand.color.background. If provided directly, this value can be a valid R color or the name of a color in brand.color or brand.color.palette.

foreground

The foreground color, defaults to brand.color.foreground. If provided directly, this value can be a valid R color or the name of a color in brand.color or brand.color.palette.

See Also

Other branded theming functions: theme_brand_ggplot2(), theme_brand_gt(), theme_brand_plotly(), theme_brand_thematic()

Examples

Run this code
if (FALSE) { # rlang::is_installed("flextable") && getRversion() >= "4.5"
brand <- as_brand_yml('
color:
  palette:
    black: "#1A1A1A"
    white: "#F9F9F9"
    orange: "#FF6F20"
  foreground: black
  background: white
  primary: orange')

library(flextable)
theme_brand_flextable(
  flextable(head(palmerpenguins::penguins)),
  brand
)
}
if (FALSE) { # rlang::is_installed("flextable") && getRversion() < "4.5"
brand <- as_brand_yml('
color:
  palette:
    black: "#1A1A1A"
    white: "#F9F9F9"
    orange: "#FF6F20"
  foreground: black
  background: white
  primary: orange')

library(flextable)
theme_brand_flextable(
  flextable(head(mtcars)),
  brand
)
}

Run the code above in your browser using DataLab