33$body-font : ' Fira Sans' , Helvetica , Arial , sans-serif ;
44$header-font : ' Alfa Slab One' , serif ;
55
6+ // Switching theme will only work if JavaScript is enabled as well
7+
68// Default light theme
7- :root {
9+ :root , :root:not ([ data-theme ]) {
810 --gray : #2a3439 ;
911 --red : #a72145 ;
1012 --yellow : #ffc832 ;
@@ -23,27 +25,38 @@ $header-font: 'Alfa Slab One', serif;
2325 --nav-links-a : #2a3439 ;
2426 --publish-date-author : #2a3439 ;
2527 --section-header-h2-color : black ;
28+ --theme-icon : #43484d ;
29+ --theme-popup-border : #43484d ;
30+ --theme-popup-bg : white ;
31+ --theme-hover : #cacaca ;
32+ --theme-choice-color : black ;
2633}
2734
2835// Dark theme
29- @media (prefers-color-scheme : dark ) {
30- :root {
31- --code-color : white ;
32- --code-bg-color : rgba (213 , 203 , 198 , 0.05 );
33- --code-border-color : rgba (213 , 203 , 198 , 0.25 );
34- --blockquote-color : rgb (195 , 205 , 210 );
35- --blockquote-bg-color : rgba (213 , 203 , 198 , 0.05 );
36- --blockquote-left-border-color : rgb (195 , 205 , 210 );
37- --body-background-color : #181a1b ;
38- --body-foreground-color : #e8e6e3 ;
39- --body-color : white ;
40- --div-brand-a-color : white ;
41- --white-elem-color : white ;
42- --white-elem-a : #d5cbc6 ;
43- --nav-links-a : #d5cbc6 ;
44- --publish-date-author : #d5cbc6 ;
45- --section-header-h2-color : white ;
46- }
36+ :root [data-theme = ' dark' ] {
37+ --gray : #2a3439 ;
38+ --red : #a72145 ;
39+ --yellow : #ffc832 ;
40+ --code-color : white ;
41+ --code-bg-color : rgba (213 , 203 , 198 , 0.05 );
42+ --code-border-color : rgba (213 , 203 , 198 , 0.25 );
43+ --blockquote-color : rgb (195 , 205 , 210 );
44+ --blockquote-bg-color : rgba (213 , 203 , 198 , 0.05 );
45+ --blockquote-left-border-color : rgb (195 , 205 , 210 );
46+ --body-background-color : #181a1b ;
47+ --body-foreground-color : #e8e6e3 ;
48+ --body-color : white ;
49+ --div-brand-a-color : white ;
50+ --white-elem-color : white ;
51+ --white-elem-a : #d5cbc6 ;
52+ --nav-links-a : #d5cbc6 ;
53+ --publish-date-author : #d5cbc6 ;
54+ --section-header-h2-color : white ;
55+ --theme-icon : #43484d ;
56+ --theme-popup-border : #43484d ;
57+ --theme-popup-bg : #141617 ;
58+ --theme-hover : #474c51 ;
59+ --theme-choice-color : #d5cbc6 ;
4760}
4861
4962html {
@@ -363,3 +376,45 @@ header h1 {
363376 border-top-left-radius : 0 ;
364377 }
365378}
379+
380+ // Theme switch popup
381+ // theme selector visible only if JavaScript is available
382+
383+ .theme-icon {
384+ display : none ;
385+ line-height : 2em ;
386+ border : 2px solid var (--theme-icon );
387+ border-radius : 5px ;
388+ padding : 0px 5px ;
389+ color : var (--theme-choice-color );
390+ & :hover {
391+ color : var (--theme-choice-color );
392+ }
393+ }
394+
395+ #theme-choice {
396+ display : none ;
397+ border : 2px solid var (--theme-popup-border );
398+ border-radius : 5px ;
399+ color : var (--theme-choice-color );
400+ background : var (--theme-popup-bg );
401+ position : absolute ;
402+ list-style : none ;
403+ font-weight : 400 ;
404+ padding : 0px ;
405+ // counterbalance vendored skeleton.css
406+ margin : 0.2em -0.5em ;
407+ }
408+
409+ .theme-item {
410+ padding : 0px 5px ;
411+ }
412+
413+ #theme-choice .showThemeDropdown {
414+ display : block ;
415+ z-index : 1 ;
416+ }
417+
418+ li .theme-item :hover {
419+ background-color : var (--theme-hover );
420+ }
0 commit comments