Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .changeset/bumpy-papers-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': patch
---

Disabled automatic browser detection of the dark color scheme.
1 change: 1 addition & 0 deletions packages/styles/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ <h1>Styles package playground</h1>
<select name="scheme" id="scheme-select" value="light" class="mb-4">
<option value="light">Light</option>
<option value="dark">Dark</option>
<option value="">Unset</option>
</select>
</fieldset>
</aside>
Expand Down
6 changes: 5 additions & 1 deletion packages/styles/playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,9 @@ document
document.getElementById('theme-select').addEventListener('change', handleThemeAppearanceChange);

document.getElementById('scheme-select').addEventListener('change', e => {
document.body.setAttribute('data-color-scheme', e.target.value);
if (e.target.value) {
document.body.setAttribute('data-color-scheme', e.target.value);
} else {
document.body.removeAttribute('data-color-scheme');
}
});
8 changes: 5 additions & 3 deletions packages/styles/src/tokens/_schemes-static.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// prefered root color-scheme
:root {
@include supports.light-dark(true) {
color-scheme: light dark;
color-scheme: light;
}

@media (prefers-color-scheme: light) {
Expand All @@ -25,7 +25,7 @@
@include schemes.dark-variables;

@include supports.light-dark(false) {
--post-fallback-prefers-light: initial;
--post-fallback-prefers-light: ;
}
}
}
Expand All @@ -44,6 +44,7 @@
}

@include supports.light-dark(false) {
// this should be set back to "initial" once we allow for automatic dark scheme again
--post-fallback-prefers-light: ;
}
}
Expand All @@ -57,7 +58,8 @@
}

@include supports.light-dark(false) {
--post-fallback-prefers-light: initial;
// this should be set back to "initial" once we allow for automatic dark scheme again
--post-fallback-prefers-light: ;
}
}
}