Skip to content

Commit 7c67f61

Browse files
committed
fix: Work around bslib's $default for BS3-4 compat
1 parent 85833f4 commit 7c67f61

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

shiny/ui/_theme_brand.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,6 @@ def _prepare_color_vars(
255255

256256
brand_color_var = f"brand_color_{thm_name}"
257257
defaults_dict[brand_color_var] = thm_color
258-
# Currently, brand.color fields are directly named after Bootstrap vars. If
259-
# that changes, we'd need to use a map here. These values can't be set to
260-
# `null !default` because they're used by maps in the Bootstrap mixins layer
261-
# and cause errors if a color is `null` rather than non-existent.
262-
defaults_dict[thm_name] = f"${brand_color_var}"
263258

264259
brand_color_palette = brand.color.to_dict(include="palette")
265260

shiny/www/py-shiny/brand/_brand-yml.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ $brand_typography_link_weight: null !default;
6969
$brand_typography_link_decoration: null !default;
7070

7171
//*-- brand.color --*//
72+
$primary: $brand_color_primary !default;
73+
$secondary: $brand_color_secondary !default;
74+
$tertiary: $brand_color_tertiary !default;
75+
$success: $brand_color_success !default;
76+
$info: $brand_color_info !default;
77+
$warning: $brand_color_warning !default;
78+
$danger: $brand_color_danger !default;
79+
$light: $brand_color_light !default;
80+
$dark: $brand_color_dark !default;
81+
7282
$body-color: $brand_color_foreground !default;
7383
$body-bg-dark: $brand_color_foreground !default;
7484
$body-bg: $brand_color_background !default;

shiny/www/shared/sass/bslib/lib/bs5/scss/_variables.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ $cyans: (
300300
// Semantically, $secondary is closest to BS3's 'default' theme color;
301301
// so use that if specified. Otherwise, use a light instead of dark gray
302302
// default color for $default since that's closer to bootstrap 3's default
303-
$default: if(variable-exists("secondary"), $secondary, $gray-300) !default;
303+
$default: if(variable-exists("secondary") and type-of($secondary) == color, $secondary, $gray-300) !default;
304304

305305
// scss-docs-start theme-color-variables
306306
$primary: $blue !default;

0 commit comments

Comments
 (0)