File tree Expand file tree Collapse file tree 4 files changed +21
-16
lines changed Expand file tree Collapse file tree 4 files changed +21
-16
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @swisspost/design-system-styles ' : patch
3+ ---
4+
5+ Disabled automatic browser detection of the dark color scheme.
Original file line number Diff line number Diff line change 1010
1111 < script src ="playground.js " defer > </ script >
1212 </ head >
13- < body >
13+ < body data-color-scheme =" light " >
1414 < aside class ="palette palette-brand p-16 ">
1515 < h1 > Styles package playground</ h1 >
1616 < fieldset id ="token-selects " class ="mt-16 ">
@@ -29,6 +29,7 @@ <h1>Styles package playground</h1>
2929 < select name ="scheme " id ="scheme-select " value ="light " class ="mb-4 ">
3030 < option value ="light "> Light</ option >
3131 < option value ="dark "> Dark</ option >
32+ < option value =""> Unset</ option >
3233 </ select >
3334 </ fieldset >
3435 </ aside >
Original file line number Diff line number Diff line change @@ -19,5 +19,9 @@ document
1919document . getElementById ( 'theme-select' ) . addEventListener ( 'change' , handleThemeAppearanceChange ) ;
2020
2121document . getElementById ( 'scheme-select' ) . addEventListener ( 'change' , e => {
22- document . body . setAttribute ( 'data-color-scheme' , e . target . value ) ;
22+ if ( e . target . value ) {
23+ document . body . dataset . colorScheme = e . target . value ;
24+ } else {
25+ delete document . body . dataset . colorScheme ;
26+ }
2327} ) ;
Original file line number Diff line number Diff line change 1010// prefered root color-scheme
1111:root {
1212 @include supports .light-dark (true) {
13- color-scheme : light dark ;
13+ color-scheme : light ;
1414 }
1515
16- @media (prefers-color-scheme : light ) {
17- @include schemes .light-variables ;
18-
19- @include supports .light-dark (false) {
20- --post-fallback-prefers-light : ;
21- }
22- }
16+ // This sets the light theme by default and does not take
17+ // into account user's preferred colors
18+ // Put back the @media (prefers-color-scheme: light/dark)
19+ // queries to define which tokens to use depending on user's
20+ // preferences once we allow for automatic dark scheme again
21+ @include schemes .light-variables ;
2322
24- @media (prefers-color-scheme : dark ) {
25- @include schemes .dark-variables ;
26-
27- @include supports .light-dark (false) {
28- --post-fallback-prefers-light : initial ;
29- }
23+ @include supports .light-dark (false) {
24+ --post-fallback-prefers-light : ;
3025 }
3126}
3227
You can’t perform that action at this time.
0 commit comments