Skip to content

Commit 0a7d066

Browse files
committed
refactor: add backward compatibility for dark theme
1 parent d08eda9 commit 0a7d066

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

scss/_functions.scss

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,6 @@ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003
318318
@return if($return-calc == true, calc(#{$value1} - #{$value2}), $value1 + unquote(" - ") + $value2);
319319
}
320320

321-
// Generate selectors for theme variants
322-
@function theme-prefix($selector) {
323-
@return #{"." + $theme-prefix + "\\:" + $selector + ", " + "." + $selector + ":not([class*='#{$theme-prefix}:'])"};
324-
}
325-
326321
@function divide($dividend, $divisor, $precision: 10) {
327322
$sign: if($dividend > 0 and $divisor > 0 or $dividend < 0 and $divisor < 0, 1, -1);
328323
$dividend: abs($dividend);
@@ -367,5 +362,5 @@ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003
367362

368363
// Generate selectors for theme variants
369364
@function theme-prefix($theme, $selector) {
370-
@return #{"[data-coreui-theme="$theme + "] ." + $theme + "\\:" + $selector + ", [data-coreui-theme="$theme + "] ." + $theme + "\\:" + $selector + ":not([class*='#{$theme}:'])"};
365+
@return #{"[data-coreui-theme="$theme + "] ." + $theme + "\\:" + $selector + ",[data-coreui-theme="$theme + "] ." + $theme + "\\:" + $selector + ":not([class*='#{$theme}:'])", "." + $theme + "-theme ." + $theme + "\\:" + $selector + ", ." + $theme + "-theme ." + $theme + "\\:" + $selector + ":not([class*='#{$theme}:'])"};
371366
}

scss/mixins/_color-mode.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
}
1414
}
1515
} @else {
16+
.#{$mode}-theme, // TODO: remove in v5
1617
[data-coreui-theme="#{$mode}"] {
1718
@content;
1819
}

scss/tests/mixins/_color-modes.test.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
}
2222
}
2323
@include expect() {
24+
.dark-theme .element, // TODO: remove in v5
2425
[data-coreui-theme=dark] .element {
2526
color: var(--cui-primary-text-emphasis);
2627
background-color: var(--cui-primary-bg-subtle);
2728
}
29+
.dark-theme, // TODO: remove in v5
2830
[data-coreui-theme=dark] {
2931
--custom-color: #3a3ff8;
3032
}

0 commit comments

Comments
 (0)