diff --git a/NEWS.md b/NEWS.md index 534c0a3f4..d316b198a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -45,6 +45,8 @@ * In `layout_column_wrap()`, when `width` is a CSS unit -- e.g. `width = "400px"` or `width = "25%"` -- and `fixed_width = FALSE`, `layout_column_wrap()` will ensure that the columns are at least `width` wide, unless the parent container is narrower than `width`. (#851) +* `bs_global_theme()` gains a `preset` argument to match the function signature of `bs_theme()`. (#896) + ## Bug fixes * `toggle_switch()` now works correctly when called from within a Shiny module. `update_switch()` worked as expected, but `toggle_switch()` didn't apply the module's namespace to the `id` of the switch to be updated. (#769) diff --git a/R/bs-global.R b/R/bs-global.R index 2985a6108..f2624d179 100644 --- a/R/bs-global.R +++ b/R/bs-global.R @@ -34,7 +34,7 @@ #' @export bs_global_theme <- function( version = version_default(), - bootswatch = NULL, + preset = NULL, bg = NULL, fg = NULL, primary = NULL, @@ -46,11 +46,13 @@ bs_global_theme <- function( base_font = NULL, code_font = NULL, heading_font = NULL, - ... + ..., + bootswatch = NULL ) { bs_global_set(bs_theme( version, - bootswatch, + preset = preset, + bootswatch = bootswatch, bg = bg, fg = fg, primary = primary, diff --git a/man/bs_global_theme.Rd b/man/bs_global_theme.Rd index bf0ba6bc3..7accc1b6a 100644 --- a/man/bs_global_theme.Rd +++ b/man/bs_global_theme.Rd @@ -13,7 +13,7 @@ \usage{ bs_global_theme( version = version_default(), - bootswatch = NULL, + preset = NULL, bg = NULL, fg = NULL, primary = NULL, @@ -25,7 +25,8 @@ bs_global_theme( base_font = NULL, code_font = NULL, heading_font = NULL, - ... + ..., + bootswatch = NULL ) bs_global_set(theme = bs_theme()) @@ -66,10 +67,14 @@ bs_global_theme_update( 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 = "bootstrap"} to effectively remove the Bootswatch theme).} +\item{preset}{The name of a theme preset, either a built-in theme provided by +bslib or a Bootswatch theme (see \code{\link[=builtin_themes]{builtin_themes()}} and +\code{\link[=bootswatch_themes]{bootswatch_themes()}} for possible values). This argument takes precedence +over the \code{bootswatch} argument and only one \code{preset} or \code{bootswatch} can be +provided. When no \code{bootswatch} theme is specified, and \code{version} is 5 or +higher, \code{preset} defaults to \code{"shiny"}. To remove the \code{"shiny"} preset, +provide a value of \code{"bootstrap"} (this value will also work in +\code{bs_theme_update()} to remove a \code{preset} or \code{bootswatch} theme).} \item{bg}{A color string for the background.} @@ -101,6 +106,11 @@ Typically a shade of blue-green.} \item{...}{arguments passed along to \code{\link[=bs_add_variables]{bs_add_variables()}}.} +\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 = "bootstrap"} to effectively remove the Bootswatch theme).} + \item{theme}{A \code{\link[=bs_theme]{bs_theme()}} object.} \item{.where}{Whether to place the variable definitions before other Sass @@ -109,15 +119,6 @@ Typically a shade of blue-green.} \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"}.} - -\item{preset}{The name of a theme preset, either a built-in theme provided by -bslib or a Bootswatch theme (see \code{\link[=builtin_themes]{builtin_themes()}} and -\code{\link[=bootswatch_themes]{bootswatch_themes()}} for possible values). This argument takes precedence -over the \code{bootswatch} argument and only one \code{preset} or \code{bootswatch} can be -provided. When no \code{bootswatch} theme is specified, and \code{version} is 5 or -higher, \code{preset} defaults to \code{"shiny"}. To remove the \code{"shiny"} preset, -provide a value of \code{"bootstrap"} (this value will also work in -\code{bs_theme_update()} to remove a \code{preset} or \code{bootswatch} theme).} } \value{ Functions that modify the global theme (e.g., \code{bs_global_set()}) diff --git a/man/figures/navset-card-pill.png b/man/figures/navset-card-pill.png index 3f0e670d5..ee42b32ba 100644 Binary files a/man/figures/navset-card-pill.png and b/man/figures/navset-card-pill.png differ diff --git a/man/figures/navset-card-underline.png b/man/figures/navset-card-underline.png index ab4fb0645..1eddc1001 100644 Binary files a/man/figures/navset-card-underline.png and b/man/figures/navset-card-underline.png differ diff --git a/man/figures/navset-pill-list.png b/man/figures/navset-pill-list.png index 1c5c7acbd..2ea0bea64 100644 Binary files a/man/figures/navset-pill-list.png and b/man/figures/navset-pill-list.png differ diff --git a/man/figures/navset-pill.png b/man/figures/navset-pill.png index f7a4e90bc..c17a4f917 100644 Binary files a/man/figures/navset-pill.png and b/man/figures/navset-pill.png differ diff --git a/man/figures/navset-tab-card.png b/man/figures/navset-tab-card.png index bc363f5e6..0935b291e 100644 Binary files a/man/figures/navset-tab-card.png and b/man/figures/navset-tab-card.png differ diff --git a/man/figures/navset-tab.png b/man/figures/navset-tab.png index 6134c3886..a62b4da28 100644 Binary files a/man/figures/navset-tab.png and b/man/figures/navset-tab.png differ diff --git a/man/figures/navset-underline.png b/man/figures/navset-underline.png index 59a599d5c..e679518b8 100644 Binary files a/man/figures/navset-underline.png and b/man/figures/navset-underline.png differ diff --git a/man/figures/page-navbar.png b/man/figures/page-navbar.png index b9e01e0d1..d35f4c0a9 100644 Binary files a/man/figures/page-navbar.png and b/man/figures/page-navbar.png differ