3
3
$body-font : ' Fira Sans' , Helvetica , Arial , sans-serif ;
4
4
$header-font : ' Alfa Slab One' , serif ;
5
5
6
+ // Switching theme will only work if JavaScript is enabled as well
7
+
6
8
// Default light theme
7
- :root {
9
+ :root , :root:not ([ data-theme ]) {
8
10
--gray : #2a3439 ;
9
11
--red : #a72145 ;
10
12
--yellow : #ffc832 ;
@@ -23,27 +25,38 @@ $header-font: 'Alfa Slab One', serif;
23
25
--nav-links-a : #2a3439 ;
24
26
--publish-date-author : #2a3439 ;
25
27
--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 ;
26
33
}
27
34
28
35
// 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 ;
47
60
}
48
61
49
62
html {
@@ -363,3 +376,38 @@ header h1 {
363
376
border-top-left-radius : 0 ;
364
377
}
365
378
}
379
+
380
+ // Theme switch popup
381
+ // theme selector visible only if JavaScript is available
382
+
383
+ .theme-icon {
384
+ line-height : 2em ;
385
+ border : 2px solid var (--theme-icon );
386
+ border-radius : 5px ;
387
+ padding : 0px 5px ;
388
+ color : var (--theme-choice-color );
389
+ }
390
+
391
+ .theme-choice {
392
+ display : none ;
393
+ border : 2px solid var (--theme-popup-border );
394
+ border-radius : 5px ;
395
+ color : var (--theme-choice-color );
396
+ background : var (--theme-popup-bg );
397
+ position : absolute ;
398
+ list-style : none ;
399
+ font-weight : 400 ;
400
+
401
+ padding : 0px 5px ;
402
+ // TODO: fix/remove these margins
403
+ margin-left : -7px ;
404
+ margin-top : 5px ;
405
+ }
406
+
407
+ #theme-choice .display {
408
+ display : block ;
409
+ }
410
+
411
+ li .theme-item :hover {
412
+ background-color : var (--theme-hover );
413
+ }
0 commit comments