Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Breaking changes

* `bs_theme()` now defaults to `preset="shiny"`. This provides an additional set of theming defaults and rules that make it easier to create Shiny apps (in particular, dashboards) that look good out of the box. To revert to the previous behavior, set `bs_theme(preset="bootstrap")`. (#711)
* `value_box()` no longer defaults to `theme_color = "primary"`. To restore the previous behavior, please use `theme = "primary"`. In addition to the default style change, the `theme_color` is now deprecated in favor of `theme`. (#758)
* `page_navbar()` now defaults to `underline = TRUE`, meaning that navigation links in the navbar now have underline styling by default (set `underline = FALSE` to revert to previous behavior). (#784)

Expand Down
14 changes: 9 additions & 5 deletions R/bs-theme.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@
#' @param preset The name of a theme preset, either a built-in theme provided by
#' bslib or a Bootswatch theme (see [builtin_themes()] and
#' [bootswatch_themes()] for possible values). This argument takes precedence
#' over the `bootswatch` argument and only one `theme` or `bootswatch` can be
#' provided. When provided to `bs_theme_update()`, any previous preset theme
#' is first removed before the new theme preset is applied. You can use
#' `theme = "bootstrap"` to remove any preset theme and to revert to a base
#' Bootstrap theme.
#' over the `bootswatch` argument and only one `preset` or `bootswatch` can be
#' provided. When no `bootswatch` theme is specified, and `version` is 5 or
#' higher, `preset` defaults to `"shiny"`. To remove the `"shiny"` preset,
#' provide a value of `"bootstrap"` (this value will also work in
#' `bs_theme_update()` to remove a `preset` or `bootswatch` theme).
#' @param bootswatch The name of a bootswatch theme (see [bootswatch_themes()]
#' for possible values). When provided to `bs_theme_update()`, any previous
#' Bootswatch theme is first removed before the new one is applied (use
Expand Down Expand Up @@ -125,6 +125,10 @@ bs_theme <- function(version = version_default(), preset = NULL, ...,
base_font = NULL, code_font = NULL, heading_font = NULL,
font_scale = NULL, bootswatch = NULL) {

if (is.null(preset) && is.null(bootswatch) && version >= 5) {
preset <- "shiny"
}

preset <- resolve_bs_preset(preset, bootswatch, version = version)

bundle <- bs_bundle(
Expand Down
1 change: 0 additions & 1 deletion inst/builtin/bs5/shiny/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/*-- scss:defaults --*/
$blue: #007bc2 !default;
$indigo: #4b00c1 !default;
$purple: #74149c !default;
Expand Down
2 changes: 1 addition & 1 deletion inst/components/dist/accordion/accordion.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion inst/components/dist/page_sidebar/page_sidebar.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion inst/components/dist/sidebar/sidebar.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/components/dist/value_box/value_box.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions inst/css-precompiled/5/bootstrap.min.css

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions inst/css-precompiled/5/bootstrap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@



$bslib-preset-type: builtin;
$bslib-preset-name: shiny;
$web-font-path: "font.css" !default;
@import "inst/builtin/bs5/shiny/_variables.scss";
$enable-cssgrid: true !default;
@import "inst/bs3compat/_defaults.scss";
@import "inst/lib/bs5/scss/_variables.scss";
Expand All @@ -13,6 +17,7 @@ $bslib-preset-type: null !default;
@import "inst/lib/bs5/scss/_maps.scss";
@import "inst/lib/bs5/scss/_mixins.scss";
@import "inst/bs3compat/_declarations.scss";
@import "inst/builtin/bs5/shiny/_mixins.scss";
:root {
--bslib-bootstrap-version: #{$bootstrap-version};
--bslib-preset-name: #{$bslib-preset-name};
Expand Down Expand Up @@ -59,3 +64,4 @@ $bslib-preset-type: null !default;
.table th[align=center] { text-align: center; }
@import "inst/bs3compat/_rules.scss";
@import "inst/bslib-scss/bslib.scss";
@import "inst/builtin/bs5/shiny/_rules.scss";
10 changes: 5 additions & 5 deletions man/bs_global_theme.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions man/bs_theme.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified man/figures/navset-card-pill.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-card-underline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-pill-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-pill.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-tab-basic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-tab-card.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-tab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-underline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/page-navbar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-background-color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-background-theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-custom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-gradient-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-named-color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-named-theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-showcase-bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-showcase-left-center.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-showcase-top-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-text-color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-text-theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-theme-class.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/testthat/test-bs-theme-preset.R
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ describe("theme_preset_info()", {

it("returns vanilla bootstrap theme information", {
expect_equal(
theme_preset_info(bs_theme(version = 5)),
theme_preset_info(bs_theme(preset = "bootstrap", version = 5)),
new_bs_preset("bootstrap", version = "5")
)

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-global.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test_that("Theme adding works as intended", {
"body-color" = "color-contrast($primary)"
)
css <- sass_partial(".foo{color:$primary;}", bs_global_get())
expect_css(".foo{color:#6c757d;}", css)
expect_css(".foo{color:#404040;}", css)
})


Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-theme-base-colors.R
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ test_that("validate_and_normalize_colors", {
test_that("bs_get_variables is fg/bg aware", {
expect_equal(
bs_get_variables(bs_theme(), c("bg", "fg")),
c(bg = "#fff", fg = "#000")
c(bg = "#ffffff", fg = "#000")
)
expect_equal(
bs_get_variables(bs_theme(version = 3), c("bg", "fg")),
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-theme-update.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test_that("bs_theme_update() can update the bootswatch theme", {
default <- bs_theme_update(cosmo, bootswatch = "default")
expect_identical(
sass::sass(default),
sass::sass(bs_theme())
sass::sass(bs_theme(preset="bootstrap"))
)
expect_null(theme_bootswatch(default))
})
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-zzzz-bs-sass.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ test_that("Can access the sass behind all versions and Bootswatch themes", {
for (version in versions()) {
# Can compile CSS against variables (in each version)
css <- sass_partial("body{background-color:$body-bg}", as_bs_theme(version))
css <- sub("#ffffff", "#fff", css)
expect_css(css, "body{background-color:#fff;}")
themes <- bootswatch_themes(version)
for (theme in themes) {
Expand Down