Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Shiny's CSS to respect BS5's dark color mode #3882

Merged
merged 4 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## New features and improvements

* Shiny's CSS styling for things like `showNotification()`, `withProgress()`, `inputPanel()`, etc., now integrate better with `{bslib}`'s upcoming CSS-only dark mode. (#3882)

## Bug fixes

* `fileInput()` no longer has unwanted round corners applied to the `buttonLabel`. (#3879)
Expand Down
2 changes: 1 addition & 1 deletion inst/www/shared/shiny.min.css

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

65 changes: 32 additions & 33 deletions inst/www/shared/shiny_scss/bootstrap.scss
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
$bg: $body-bg !default;
$prefix: bs- !default; // BS5 CSS variable prefix

$fg: null !default;
$theme-colors: null !default;
@if variable-exists('text-color') {
$fg: $text-color !default; // BS3
$theme-colors: ("primary": $brand-primary, "info": $brand-info, "warning": $brand-warning, "danger": $brand-danger) !default;
} @else {
$fg: $body-color !default; // BS4
}
// No $border-width, $border-color, or $border-radius in BS3
// No $border-width, $border-radius, or $border-color in BS3
$border-width: 1px !default;
$border-color: mix($bg, $fg, 70%) !default;
$border-radius: $border-radius-base !default;
$border-color: mix($body-bg, $text-color, 70%) !default;

// No rgb CSS vars available in BS3-4
$primary-rgb: var(--#{$prefix}primary-rgb, red($primary),green($primary),blue($primary)) !default;
$info-rgb: var(--#{$prefix}info-rgb, red($info), green($info), blue($info)) !default;
$warning-rgb: var(--#{$prefix}warning-rgb, red($warning), green($warning), blue($warning)) !default;
$danger-rgb: var(--#{$prefix}danger-rgb, red($danger), green($danger), blue($danger)) !default;


$shiny-disconnected-bg: mix($bg, $fg, 58%) !default;
$shiny-table-na: mix($bg, $fg, 54%) !default;
$shiny-error-validated-color: mix($bg, $fg, 50%) !default;
// TODO: what should this be? mix of primary and bg?
$shiny-progress-text-bg-color: #eef8ff !default;
$shiny-input-panel-bg: mix($bg, $fg, 96%) !default;
$shiny-input-panel-border: $border-width solid $border-color !default;
$shiny-emphasis-color-rgb: var(--#{$prefix}emphasis-color-rgb, 0,0,0) !default;
$shiny-disconnected-bg: RGBA($shiny-emphasis-color-rgb, 0.42) !default;
$shiny-table-na: RGBA($shiny-emphasis-color-rgb, 0.46) !default;
$shiny-error-validated-color: RGBA($shiny-emphasis-color-rgb, 0.5) !default;
$shiny-progress-text-bg-color: RGBA($primary-rgb, 0.05) !default;
$shiny-input-panel-bg: RGBA($shiny-emphasis-color-rgb, 0.04) !default;
$shiny-input-panel-border: $border-width solid var(--#{$prefix}border-color, $border-color) !default;
$shiny-input-panel-border-radius: $border-radius !default;
$shiny-text-output-border-radius: $border-radius !default;
$notification-bg-color: mix($bg, $fg, 90%) !default;
$notification-color: $fg !default;
$notification-border: $border-width solid $border-color !default;
$notification-bg-color: RGBA($shiny-emphasis-color-rgb, 0.05) !default;
$notification-color: $shiny-emphasis-color-rgb !default;
$notification-border: $border-width solid var(--#{$prefix}border-color, $border-color) !default;
$notification-border-radius: $border-radius !default;
$notification-message-bg: mix($bg, map-get($theme-colors, "info"), 90%) !default;
$notification-message-color: mix($fg, map-get($theme-colors, "info"), 10%) !default;
$notification-message-border: $border-width solid mix($bg, map-get($theme-colors, "info"), 53%) !default;
$notification-warning-bg: mix($bg, map-get($theme-colors, "warning"), 90%) !default;
$notification-warning-color: mix($fg, map-get($theme-colors, "warning"), 10%) !default;
$notification-warning-border: $border-width solid mix($bg, map-get($theme-colors, "warning"), 71%) !default;
$notification-error-bg: mix($bg, map-get($theme-colors, "danger"), 90%) !default;
$notification-error-color: mix($fg, map-get($theme-colors, "danger"), 10%) !default;
$notification-error-border: $border-width solid mix($bg, map-get($theme-colors, "danger"), 79%) !default;
$notification-close-color: mix($bg, $fg, 20%) !default;
$notification-close-hover-color: $fg !default;
$notification-content-action-color: map-get($theme-colors, "primary") !default;
$notification-message-bg: RGBA($info-rgb, 0.05) !default;
$notification-message-color: RGBA($info-rgb, 1) !default;
$notification-message-border: $border-width solid RGBA($info-rgb, 0.5) !default;
$notification-warning-bg: RGBA($warning-rgb, 0.05) !default;
$notification-warning-color: RGBA($warning-rgb, 0.9) !default;
$notification-warning-border: $border-width solid RGBA($warning-rgb, 0.3) !default;
$notification-error-bg: RGBA($danger-rgb, 0.05) !default;
$notification-error-color: RGBA($danger-rgb, 0.9) !default;
$notification-error-border: $border-width solid RGBA($warning-rgb, 0.2) !default;
$notification-close-color: RGBA($shiny-emphasis-color-rgb, 0.8) !default;
$notification-close-hover-color: RGB($shiny-emphasis-color-rgb) !default;
$notification-content-action-color: RGB($primary-rgb) !default;
$datepicker-disabled-color: $dropdown-link-disabled-color !default;

// I don't think BS3 has a file input box shadow setting
Expand Down
Loading