From a480bfd5dc23819d651a7df8ba81f53d46408a2c Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Wed, 4 Oct 2023 15:53:08 -0400 Subject: [PATCH] feat: Use "cosmo" bootswatch only if neither `preset` nor `bootswatch` are set --- R/bslib.R | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/R/bslib.R b/R/bslib.R index e5a522c..77a6778 100644 --- a/R/bslib.R +++ b/R/bslib.R @@ -24,7 +24,13 @@ resolve_theme <- function(theme) { # Default to cosmo theme (just like the non-bslib usage does) # (Users can explictly opt-out with bootswatch: default) if (!is_bs_theme(theme)) { - theme <- utils::modifyList(list(bootswatch = "cosmo"), theme) + theme_default <- list() + # bslib 0.5.1 added the "preset" option, which flexdashboard users may provide + # However, `preset` should not be set with `bootswatch` + if (packageVersion("bslib") < "0.5.1" && !"preset" %in% names(theme)) { + theme_default$bootswatch <- "cosmo" + } + theme <- utils::modifyList(theme_default, theme) theme <- do.call(bs_theme, theme) } # Also default to enable-rounded: true