1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bs-global.R, R/bs-theme.R
\name{bs_global_theme}
\alias{bs_global_theme}
\alias{bs_global_set}
\alias{bs_global_get}
\alias{bs_global_clear}
\alias{bs_global_add_variables}
\alias{bs_global_add_rules}
\alias{bs_global_bundle}
\alias{bs_global_theme_update}
\title{Global theming}
\usage{
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(
...,
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
)
}
\arguments{
\item{version}{The major version of Bootstrap to use (see \code{\link[=versions]{versions()}}
for possible values). Defaults to the currently recommended version
for new projects (currently Bootstrap 5).}
\item{bootswatch}{The name of a bootswatch theme (see \code{\link[=bootswatch_themes]{bootswatch_themes()}}
for possible values). When provided to \code{bs_theme_update()}, any previous
Bootswatch theme is first removed before the new one is applied (use
\code{bootswatch = "default"} to effectively remove the Bootswatch theme).}
\item{bg}{A color string for the background.}
\item{fg}{A color string for the foreground.}
\item{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.}
\item{secondary}{A color for components and messages that don't need to stand
out. (Not supported in Bootstrap 3.)}
\item{success}{A color for messages that indicate an operation has succeeded.
Typically green.}
\item{info}{A color for messages that are informative but not critical.
Typically a shade of blue-green.}
\item{warning}{A color for warning messages. Typically yellow.}
\item{danger}{A color for errors. Typically red.}
\item{base_font}{The default typeface.}
\item{code_font}{The typeface to be used for code. Be sure this is monospace!}
\item{heading_font}{The typeface to be used for heading elements.}
\item{...}{arguments passed along to \code{\link[=bs_add_variables]{bs_add_variables()}}.}
\item{theme}{a \code{\link[=bs_theme]{bs_theme()}} object.}
\item{.where}{Whether to place the variable definitions before other Sass
\code{"defaults"}, after other Sass \code{"declarations"}, or after other Sass
\code{"rules"}.}
\item{.default_flag}{Whether or not to add a \code{!default} flag (if missing) to
variable expressions. It's recommended to keep this as \code{TRUE} when \code{.where = "defaults"}.}
}
\value{
functions that modify the global theme (e.g., \code{bs_global_set()})
invisibly return the previously set theme. \code{bs_global_get()} returns the
current global theme.
}
\description{
\code{bs_global_theme()} creates a new (global) Bootstrap Sass theme which
\code{\link[=bs_theme_dependencies]{bs_theme_dependencies()}} (or \code{\link[=sass_partial]{sass_partial()}}) can consume (their \code{theme}
argument defaults to \code{bs_global_get()}, which get the current global theme).
}
\examples{
# 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)
}
\seealso{
\code{\link[=bs_theme]{bs_theme()}}, \code{\link[=bs_theme_preview]{bs_theme_preview()}}
}
|