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

Fix Sass compilation when $color-mode-type is set to media-query #37687

Merged
merged 3 commits into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions scss/_carousel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@

// Dark mode carousel

%carousel-dark {
@mixin carousel-dark() {
.carousel-control-prev-icon,
.carousel-control-next-icon {
filter: $carousel-dark-control-icon-filter;
Expand All @@ -226,13 +226,13 @@
}

.carousel-dark {
@extend %carousel-dark;
@include carousel-dark();
}

@if $enable-dark-mode {
@include color-mode(dark) {
.carousel {
@extend %carousel-dark;
@include carousel-dark();
}
}
}
6 changes: 3 additions & 3 deletions scss/_close.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@
}
}

%btn-close-white {
@mixin btn-close-white() {
filter: var(--#{$prefix}btn-close-white-filter);
}

.btn-close-white {
@extend %btn-close-white;
@include btn-close-white();
}

@if $enable-dark-mode {
@include color-mode(dark) {
.btn-close {
@extend %btn-close-white;
@include btn-close-white();
}
}
}
2 changes: 1 addition & 1 deletion scss/_root.scss
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
}

@if $enable-dark-mode {
@include color-mode(dark) {
@include color-mode(dark, true) {
// scss-docs-start root-dark-mode-vars
--#{$prefix}body-color: #{$body-color-dark};
--#{$prefix}body-color-rgb: #{to-rgb($body-color-dark)};
Expand Down
2 changes: 1 addition & 1 deletion scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ $enable-deprecation-messages: true !default;
$enable-important-utilities: true !default;

$enable-dark-mode: true !default;
$color-mode-type: data !default;
$color-mode-type: data !default; // `data` or `media-query`

// Prefix for :root CSS variables

Expand Down
16 changes: 12 additions & 4 deletions scss/mixins/_color-mode.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
// scss-docs-start color-mode-mixin
@mixin color-mode($mode: light, $type: $color-mode-type) {
@if $type == "media-query" {
@media (prefers-color-scheme: $mode) {
@content;
@mixin color-mode($mode: light, $root: false) {
@if $color-mode-type == "media-query" {
@if $root == true {
@media (prefers-color-scheme: $mode) {
:root {
@content;
}
}
} @else {
@media (prefers-color-scheme: $mode) {
@content;
}
}
} @else {
[data-bs-theme="#{$mode}"] {
Expand Down
2 changes: 1 addition & 1 deletion site/assets/scss/_syntax.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
--base0F: #333;
}

[data-bs-theme="dark"] {
@include color-mode(dark, true) {
--base00: #282c34;
--base01: #353b45;
--base02: #3e4451;
Expand Down
2 changes: 1 addition & 1 deletion site/assets/scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $bd-callout-variants: info, warning, danger !default;
--bd-sidebar-link-bg: rgba(var(--bd-violet-rgb), .1);
}

[data-bs-theme="dark"] {
@include color-mode(dark, true) {
--bd-violet: #{mix($bd-violet, $white, 75%)};
--bd-violet-bg: #{$bd-violet};
--bd-sidebar-link-bg: rgba(#{to-rgb(mix($bd-violet, $black, 75%))}, .5);
Expand Down