0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-17 14:54:30 +01:00

Merge ddcb9a358509ec575fb207905629144a83974e0b into ec96eacd0e6f297a64ee058b22ce9f567c0860e3

This commit is contained in:
Louis-Maxime Piton 2024-11-25 16:05:21 +01:00 committed by GitHub
commit caad37b859
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 67 additions and 61 deletions

View File

@ -144,10 +144,8 @@
}
@if $enable-dark-mode {
@include color-mode(dark) {
.accordion-button::after {
--#{$prefix}accordion-btn-icon: #{escape-svg($accordion-button-icon-dark)};
--#{$prefix}accordion-btn-active-icon: #{escape-svg($accordion-button-active-icon-dark)};
}
@include color-mode(dark, ".accordion-button::after") {
--#{$prefix}accordion-btn-icon: #{escape-svg($accordion-button-icon-dark)};
--#{$prefix}accordion-btn-active-icon: #{escape-svg($accordion-button-active-icon-dark)};
}
}

View File

@ -221,16 +221,7 @@
}
@if $enable-dark-mode {
@include color-mode(dark) {
@if $color-mode-type == "media-query" {
.carousel {
@include carousel-dark();
}
} @else {
.carousel,
&.carousel {
@include carousel-dark();
}
}
@include color-mode(dark, ".carousel") {
@include carousel-dark();
}
}

View File

@ -55,9 +55,7 @@
}
@if $enable-dark-mode {
@include color-mode(dark) {
.btn-close {
@include btn-close-white();
}
@include color-mode(dark, ".btn-close") {
@include btn-close-white();
}
}

View File

@ -266,8 +266,7 @@
@include deprecate("`.navbar-light`", "v5.2.0", "v6.0.0", true);
}
.navbar-dark,
.navbar[data-bs-theme="dark"] {
@mixin navbar-dark() {
// scss-docs-start navbar-dark-css-vars
--#{$prefix}navbar-color: #{$navbar-dark-color};
--#{$prefix}navbar-hover-color: #{$navbar-dark-hover-color};
@ -280,10 +279,16 @@
// scss-docs-end navbar-dark-css-vars
}
.navbar-dark {
@include navbar-dark();
}
@if $enable-dark-mode {
@include color-mode(dark) {
.navbar-toggler-icon {
--#{$prefix}navbar-toggler-icon-bg: #{escape-svg($navbar-dark-toggler-icon-bg)};
}
@include color-mode(dark, ".navbar") {
@include navbar-dark();
}
@include color-mode(dark, ".navbar-toggler-icon") {
--#{$prefix}navbar-toggler-icon-bg: #{escape-svg($navbar-dark-toggler-icon-bg)};
}
}

View File

@ -130,7 +130,7 @@
}
@if $enable-dark-mode {
@include color-mode(dark, true) {
@include color-mode(dark) {
color-scheme: dark;
// scss-docs-start root-dark-mode-vars

View File

@ -181,9 +181,7 @@
}
@if $enable-dark-mode {
@include color-mode(dark) {
.form-switch .form-check-input:not(:checked):not(:focus) {
--#{$prefix}form-switch-bg: #{escape-svg($form-switch-bg-image-dark)};
}
@include color-mode(dark, ".form-switch .form-check-input:not(:checked):not(:focus)") {
--#{$prefix}form-switch-bg: #{escape-svg($form-switch-bg-image-dark)};
}
}

View File

@ -72,9 +72,7 @@
}
@if $enable-dark-mode {
@include color-mode(dark) {
.form-select {
--#{$prefix}form-select-bg-img: #{escape-svg($form-select-indicator-dark)};
}
@include color-mode(dark, ".form-select") {
--#{$prefix}form-select-bg-img: #{escape-svg($form-select-indicator-dark)};
}
}

View File

@ -1,7 +1,7 @@
// scss-docs-start color-mode-mixin
@mixin color-mode($mode: light, $root: false) {
@if $color-mode-type == "media-query" {
@if $root == true {
@mixin color-mode($mode: light, $selector: null) {
@if $color-mode-type == media-query {
@if $selector == null {
@media (prefers-color-scheme: $mode) {
:root {
@content;
@ -9,12 +9,35 @@
}
} @else {
@media (prefers-color-scheme: $mode) {
@content;
#{$selector} {
@content;
}
}
}
} @else {
[data-bs-theme="#{$mode}"] {
@content;
@if $selector == null {
[data-bs-theme="#{$mode}"] {
@content;
}
} @else {
$tmp: str-replace($selector, " ", "[data-bs-theme=\"#{$mode}\"] ");
@if $tmp != $selector {
#{$tmp},
[data-bs-theme="#{$mode}"] #{$selector},
#{$selector}[data-bs-theme="#{$mode}"] {
@content;
}
} @else if str-index($selector, $substring: "::") != null {
[data-bs-theme="#{$mode}"] #{$selector},
#{str-replace($selector, "::", "[data-bs-theme=\"#{$mode}\"]::")} {
@content;
}
} @else {
[data-bs-theme="#{$mode}"] #{$selector},
#{$selector}[data-bs-theme="#{$mode}"] {
@content;
}
}
}
}
}

View File

@ -10,18 +10,17 @@
@include it("generates data attribute selectors for dark mode") {
@include assert() {
@include output() {
@include color-mode(dark) {
.element {
color: var(--bs-primary-text-emphasis);
background-color: var(--bs-primary-bg-subtle);
}
@include color-mode(dark, ".element") {
color: var(--bs-primary-text-emphasis);
background-color: var(--bs-primary-bg-subtle);
}
@include color-mode(dark, true) {
@include color-mode(dark) {
--custom-color: #{mix($indigo, $blue, 50%)};
}
}
@include expect() {
[data-bs-theme=dark] .element {
[data-bs-theme=dark] .element,
.element[data-bs-theme=dark] {
color: var(--bs-primary-text-emphasis);
background-color: var(--bs-primary-bg-subtle);
}
@ -39,13 +38,11 @@
@include assert() {
@include output() {
@include color-mode(dark) {
.element {
color: var(--bs-primary-text-emphasis);
background-color: var(--bs-primary-bg-subtle);
}
@include color-mode(dark, ".element") {
color: var(--bs-primary-text-emphasis);
background-color: var(--bs-primary-bg-subtle);
}
@include color-mode(dark, true) {
@include color-mode(dark) {
--custom-color: #{mix($indigo, $blue, 50%)};
}
}

View File

@ -126,8 +126,6 @@
}
}
@include color-mode(dark) {
.bd-navbar {
box-shadow: 0 .5rem 1rem rgba($black, .15), inset 0 -1px 0 rgba($white, .15);
}
@include color-mode(dark, ".bd-navbar") {
box-shadow: 0 .5rem 1rem rgba($black, .15), inset 0 -1px 0 rgba($white, .15);
}

View File

@ -5,7 +5,7 @@
--docsearch-logo-color: var(--bd-violet);
}
@include color-mode(dark, true) {
@include color-mode(dark) {
// From here, the values are copied from https://cdn.jsdelivr.net/npm/@docsearch/css@3
// in html[data-theme="dark"] selector
// and are slightly modified for formatting purpose

View File

@ -18,7 +18,7 @@
--base0F: #333;
}
@include color-mode(dark, true) {
@include color-mode(dark) {
// --base00: #282c34;
// --base01: #353b45;
--base02: #3e4451;

View File

@ -24,7 +24,7 @@ $bd-callout-variants: info, warning, danger !default;
--bd-pre-bg: var(--bs-tertiary-bg);
}
@include color-mode(dark, true) {
@include color-mode(dark) {
--bd-violet: #{mix($bd-violet, $white, 75%)};
--bd-violet-bg: #{$bd-violet};
--bd-toc-color: var(--#{$prefix}emphasis-color);