Skip to content

Commit

Permalink
Merge pull request #1261 from primer/color-mode-mixin-fix
Browse files Browse the repository at this point in the history
Fix for color-mode-theme mixin
  • Loading branch information
jonrohan authored Mar 26, 2021
2 parents a6408ac + 739412b commit b720816
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/witty-donuts-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/css': patch
---

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.
6 changes: 3 additions & 3 deletions src/base/modes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
// Outputs the CSS variables
// Use :root (html element) to define a default

@include color-mode-theme(light, light, true) {
@include color-mode-theme(light, true) {
@include primer-colors-light;
}

@include color-mode-theme(dark, dark) {
@include color-mode-theme(dark) {
@include primer-colors-dark;
}

@include color-mode-theme(dark_dimmed, dark) {
@include color-mode-theme(dark_dimmed) {
@include primer-colors-dark_dimmed;
}

Expand Down
8 changes: 5 additions & 3 deletions src/support/mixins/color-modes.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
@mixin color-mode-theme($theme-name, $type, $include-root: false) {
@mixin color-mode-theme($theme-name, $include-root: false) {
@if $include-root {
:root,
[data-color-mode="#{$type}"][data-#{$type}-theme="#{$theme-name}"] {
[data-color-mode="light"][data-light-theme="#{$theme-name}"],
[data-color-mode="dark"][data-dark-theme="#{$theme-name}"] {
@content;
}
}
@else {
[data-color-mode="#{$type}"][data-#{$type}-theme="#{$theme-name}"] {
[data-color-mode="light"][data-light-theme="#{$theme-name}"],
[data-color-mode="dark"][data-dark-theme="#{$theme-name}"] {
@content;
}
}
Expand Down

1 comment on commit b720816

@vercel
Copy link

@vercel vercel bot commented on b720816 Mar 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.