From 04e667dbb486ebb12b272c7831b5f3e141447ef6 Mon Sep 17 00:00:00 2001 From: Bo Werth Date: Mon, 23 Feb 2026 11:51:13 +0100 Subject: [PATCH 1/3] use functions from brand.yml package --- inst/examples-shiny/brand.yml/app.R | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/inst/examples-shiny/brand.yml/app.R b/inst/examples-shiny/brand.yml/app.R index 166f94cfa..a2477390a 100644 --- a/inst/examples-shiny/brand.yml/app.R +++ b/inst/examples-shiny/brand.yml/app.R @@ -1,11 +1,13 @@ rlang::check_installed("shiny", version = "1.8.1") rlang::check_installed("bslib", version = "0.8.0.9000") +rlang::check_installed("brand.yml") rlang::check_installed("future") rlang::check_installed("ggplot2") rlang::check_installed("markdown") library(shiny) library(bslib) +library(brand.yml) library(ggplot2) library(future) @@ -24,7 +26,7 @@ BRAND_PATH <- brand$path %||% "_brand.yml" theme_set(theme_minimal()) if (requireNamespace("thematic", quietly = TRUE)) { - base_font <- bslib:::brand_pluck(brand, "typography", "base", "family") + base_font <- brand.yml::brand_pluck(brand, "typography", "base", "family") if (!is.null(base_font)) { # TODO: Update plot fonts dynamically thematic::thematic_shiny(font = base_font) @@ -43,7 +45,7 @@ is_app_packaged <- getwd() == system.file("examples-shiny/brand.yml", package = "bslib") use_download_button <- is_app_hosted || is_app_packaged -if (bslib:::brand_has(brand, "typography", "fonts")) { +if (brand.yml::brand_has(brand, "typography", "fonts")) { tryCatch( { if (brand$typography$fonts[[2]]$files[[1]]$path == "Monda.ttf") { @@ -437,8 +439,8 @@ server <- function(input, output, session) { output$brand_name <- renderUI({ brand_name <- - bslib:::brand_pluck(brand_yml(), "meta", "name", "short") %||% - bslib:::brand_pluck(brand_yml(), "meta", "name") + brand.yml::brand_pluck(brand_yml(), "meta", "name", "short") %||% + brand.yml::brand_pluck(brand_yml(), "meta", "name") if (rlang::is_string(brand_name)) brand_name else "brand.yml Demo" }) @@ -447,8 +449,8 @@ server <- function(input, output, session) { brand <- brand_yml() logo <- - bslib:::brand_pluck(brand, "logo", "small") %||% - bslib:::brand_pluck(brand, "logo") + brand.yml::brand_pluck(brand, "logo", "small") %||% + brand.yml::brand_pluck(brand, "logo") req(rlang::is_string(logo)) From c8973e716816f7e092422bdebbf1638f25ae1864 Mon Sep 17 00:00:00 2001 From: Bo Werth Date: Tue, 24 Feb 2026 11:26:56 +0100 Subject: [PATCH 2/3] drop brand.yml:: prefix, add news entry --- NEWS.md | 4 ++++ inst/examples-shiny/brand.yml/app.R | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index c485e7626..faf36b5a4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # bslib (development version) +## Improvements and bug fixes + +* use `brand_pluck()` and `brand_has()` from `{brand.yml}` in `shiny::runExample("brand.yml", package = "bslib")`. (#1288) + # bslib 0.10.0 ## Breaking changes diff --git a/inst/examples-shiny/brand.yml/app.R b/inst/examples-shiny/brand.yml/app.R index a2477390a..d89d2740d 100644 --- a/inst/examples-shiny/brand.yml/app.R +++ b/inst/examples-shiny/brand.yml/app.R @@ -26,7 +26,7 @@ BRAND_PATH <- brand$path %||% "_brand.yml" theme_set(theme_minimal()) if (requireNamespace("thematic", quietly = TRUE)) { - base_font <- brand.yml::brand_pluck(brand, "typography", "base", "family") + base_font <- brand_pluck(brand, "typography", "base", "family") if (!is.null(base_font)) { # TODO: Update plot fonts dynamically thematic::thematic_shiny(font = base_font) @@ -45,7 +45,7 @@ is_app_packaged <- getwd() == system.file("examples-shiny/brand.yml", package = "bslib") use_download_button <- is_app_hosted || is_app_packaged -if (brand.yml::brand_has(brand, "typography", "fonts")) { +if (brand_has(brand, "typography", "fonts")) { tryCatch( { if (brand$typography$fonts[[2]]$files[[1]]$path == "Monda.ttf") { @@ -439,8 +439,8 @@ server <- function(input, output, session) { output$brand_name <- renderUI({ brand_name <- - brand.yml::brand_pluck(brand_yml(), "meta", "name", "short") %||% - brand.yml::brand_pluck(brand_yml(), "meta", "name") + brand_pluck(brand_yml(), "meta", "name", "short") %||% + brand_pluck(brand_yml(), "meta", "name") if (rlang::is_string(brand_name)) brand_name else "brand.yml Demo" }) @@ -449,8 +449,8 @@ server <- function(input, output, session) { brand <- brand_yml() logo <- - brand.yml::brand_pluck(brand, "logo", "small") %||% - brand.yml::brand_pluck(brand, "logo") + brand_pluck(brand, "logo", "small") %||% + brand_pluck(brand, "logo") req(rlang::is_string(logo)) From fa27d30aec4d78f02ad997ea6670f16bf3e6928d Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Tue, 24 Feb 2026 11:27:36 -0500 Subject: [PATCH 3/3] chore: adjust news bullet --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index faf36b5a4..638c15bed 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,7 +2,7 @@ ## Improvements and bug fixes -* use `brand_pluck()` and `brand_has()` from `{brand.yml}` in `shiny::runExample("brand.yml", package = "bslib")`. (#1288) +* The brand.yml example app (`shiny::runExample("brand.yml", package = "bslib")`) now uses `brand_pluck()` and `brand_has()` from `{brand.yml}`. (#1288) # bslib 0.10.0