View source: R/bs-theme-preview.R
bs_get_variables | R Documentation |
Useful for retrieving a variable from the current theme and using the value to inform another R function.
bs_get_variables(theme, varnames)
bs_get_contrast(theme, varnames)
theme |
A |
varnames |
A character string referencing a Sass variable in the current theme. |
Returns a character string containing a CSS/Sass value. If the
variable(s) are not defined, their value is NA
.
Theming: Bootstrap 5 variables provides a searchable reference of all theming variables available in Bootstrap 5.
Other Bootstrap theme utility functions:
bootswatch_themes()
,
builtin_themes()
,
theme_bootswatch()
,
theme_version()
,
versions()
vars <- c("body-bg", "body-color", "primary", "border-radius")
bs_get_variables(bs_theme(), varnames = vars)
bs_get_variables(bs_theme(bootswatch = "darkly"), varnames = vars)
bs_get_contrast(bs_theme(), c("primary", "dark", "light"))
library(htmltools)
div(
class = "bg-primary",
style = css(
color = bs_get_contrast(bs_theme(), "primary")
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.