bs_global_theme {bslib} | R Documentation |
bs_global_theme()
creates a new (global) Bootstrap Sass theme which
bs_theme_dependencies()
(or sass_partial()
) can consume (their theme
argument defaults to bs_global_get()
, which get the current global theme).
bs_global_theme(
version = version_default(),
bootswatch = NULL,
bg = NULL,
fg = NULL,
primary = NULL,
secondary = NULL,
success = NULL,
info = NULL,
warning = NULL,
danger = NULL,
base_font = NULL,
code_font = NULL,
heading_font = NULL,
...
)
bs_global_set(theme = bs_theme())
bs_global_get()
bs_global_clear()
bs_global_add_variables(
...,
.where = "defaults",
.default_flag = identical(.where, "defaults")
)
bs_global_add_rules(...)
bs_global_bundle(...)
bs_global_theme_update(
...,
preset = NULL,
bg = NULL,
fg = NULL,
primary = NULL,
secondary = NULL,
success = NULL,
info = NULL,
warning = NULL,
danger = NULL,
base_font = NULL,
code_font = NULL,
heading_font = NULL,
bootswatch = NULL
)
version |
The major version of Bootstrap to use (see |
bootswatch |
The name of a bootswatch theme (see |
bg |
A color string for the background. |
fg |
A color string for the foreground. |
primary |
A color to be used for hyperlinks, to indicate primary/default actions, and to show active selection state in some Bootstrap components. Generally a bold, saturated color that contrasts with the theme's base colors. |
secondary |
A color for components and messages that don't need to stand out. (Not supported in Bootstrap 3.) |
success |
A color for messages that indicate an operation has succeeded. Typically green. |
info |
A color for messages that are informative but not critical. Typically a shade of blue-green. |
warning |
A color for warning messages. Typically yellow. |
danger |
A color for errors. Typically red. |
base_font |
The default typeface. |
code_font |
The typeface to be used for code. Be sure this is monospace! |
heading_font |
The typeface to be used for heading elements. |
... |
arguments passed along to |
theme |
a |
.where |
Whether to place the variable definitions before other Sass
|
.default_flag |
Whether or not to add a |
preset |
The name of a theme preset, either a built-in theme provided by
bslib or a Bootswatch theme (see |
functions that modify the global theme (e.g., bs_global_set()
)
invisibly return the previously set theme. bs_global_get()
returns the
current global theme.
bs_theme()
, bs_theme_preview()
# Remember the global state now (so we can restore later)
theme <- bs_global_get()
# Use Bootstrap 3 (globally) with some theme customization
bs_global_theme(3, bg = "#444", fg = "#e4e4e4", primary = "#e39777")
if (interactive()) bs_theme_preview(with_themer = FALSE)
# If no global theme is active, bs_global_get() returns NULL
bs_global_clear()
bs_global_get()
# Restore the original state
bs_global_set(theme)