background_color: Change background color

View source: R/background-color.R

background_colorR Documentation

Change background color

Description

The background_color() and background_subtle() functions adjust the background color of a tag element.

Usage

background_color(x, color)

background_subtle(x, color)

Arguments

x

A tag element or .style pronoun.

color

A character string specifying a color. One of,

  • "primary"

  • "secondary"

  • "success"

  • "danger"

  • "warning"

  • "info"

  • "light"

  • "dark"

Value

An object of the same type as x.

Examples


library(htmltools)

div(
  .style %>%
    background_color(theme_primary()),
  "Primary background"
)

div(
  .style %>%
    background_color(theme_danger()),
  "Danger background"
)

div(
  .style %>%
    background_subtle(theme_warning()) %>%
    border_subtle(theme_warning()) %>%
    text_emphasis(theme_warning()),
  "Warning!"
)


div(
  .style %>%
    background_subtle(theme_dark()) %>%
    border_subtle(theme_dark())
)


cascadess documentation built on Oct. 30, 2024, 9:29 a.m.