Skip to content

Commit b720816

Browse files
authored
Merge pull request #1261 from primer/color-mode-mixin-fix
Fix for color-mode-theme mixin
2 parents a6408ac + 739412b commit b720816

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

.changeset/witty-donuts-rest.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/css': patch
3+
---
4+
5+
Fixing the `color-mode-theme` mixin. Currently the mixin doesn't take into account when `mode="light"` and `light-theme="dark"`. This fix allows dark themes to be set as light themes and to toggle into single light mode.

src/base/modes.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
// Outputs the CSS variables
1010
// Use :root (html element) to define a default
1111

12-
@include color-mode-theme(light, light, true) {
12+
@include color-mode-theme(light, true) {
1313
@include primer-colors-light;
1414
}
1515

16-
@include color-mode-theme(dark, dark) {
16+
@include color-mode-theme(dark) {
1717
@include primer-colors-dark;
1818
}
1919

20-
@include color-mode-theme(dark_dimmed, dark) {
20+
@include color-mode-theme(dark_dimmed) {
2121
@include primer-colors-dark_dimmed;
2222
}
2323

src/support/mixins/color-modes.scss

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
@mixin color-mode-theme($theme-name, $type, $include-root: false) {
1+
@mixin color-mode-theme($theme-name, $include-root: false) {
22
@if $include-root {
33
:root,
4-
[data-color-mode="#{$type}"][data-#{$type}-theme="#{$theme-name}"] {
4+
[data-color-mode="light"][data-light-theme="#{$theme-name}"],
5+
[data-color-mode="dark"][data-dark-theme="#{$theme-name}"] {
56
@content;
67
}
78
}
89
@else {
9-
[data-color-mode="#{$type}"][data-#{$type}-theme="#{$theme-name}"] {
10+
[data-color-mode="light"][data-light-theme="#{$theme-name}"],
11+
[data-color-mode="dark"][data-dark-theme="#{$theme-name}"] {
1012
@content;
1113
}
1214
}

0 commit comments

Comments
 (0)