From 514ad80d9be6290263a65d0fe2a46cf61f500402 Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Tue, 19 Nov 2024 08:51:55 -0500 Subject: [PATCH] fix: Call `color-contrast` only if `type-of() == "color"` --- inst/builtin/bs5/shiny/_variables.scss | 2 +- inst/components/scss/sidebar.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/inst/builtin/bs5/shiny/_variables.scss b/inst/builtin/bs5/shiny/_variables.scss index a0168ced8..71d44d4d4 100644 --- a/inst/builtin/bs5/shiny/_variables.scss +++ b/inst/builtin/bs5/shiny/_variables.scss @@ -143,7 +143,7 @@ $bslib-sidebar-fg: null !default; @if $bslib-sidebar-bg == null { // if sidebar-bg not set by user, default to body background $bslib-sidebar-bg: RGBA(var(--#{$prefix}body-bg-rgb), 0.05); -} @else if $bslib-sidebar-fg == null { +} @else if $bslib-sidebar-fg == null and type-of($bslib-sidebar-bg) == "color" { // if sidebar-bg but not -fg set by the user, find a contrasting color $bslib-sidebar-fg: color-contrast($bslib-sidebar-bg); } diff --git a/inst/components/scss/sidebar.scss b/inst/components/scss/sidebar.scss index 5b0c8b091..e156c30ad 100644 --- a/inst/components/scss/sidebar.scss +++ b/inst/components/scss/sidebar.scss @@ -5,7 +5,7 @@ $bslib-sidebar-fg: null !default; @if $bslib-sidebar-bg == null { // sidebar bg not set by the user $bslib-sidebar-bg: rgba(var(--bs-emphasis-color-rgb, 0,0,0), 0.05); -} @else if $bslib-sidebar-fg == null { +} @else if $bslib-sidebar-fg == null and type-of($bslib-sidebar-bg) == "color" { // sidebar bg set, fg unset $bslib-sidebar-fg: color-contrast($bslib-sidebar-bg); }