@@ -6,7 +6,7 @@ $header-font: 'Alfa Slab One', serif;
6
6
// Switching theme will only work if JavaScript is enabled as well
7
7
8
8
// Default light theme
9
- :root , :root:not ([ data-theme ]) {
9
+ :root {
10
10
--gray : #2a3439 ;
11
11
--red : #a72145 ;
12
12
--yellow : #ffc832 ;
@@ -33,32 +33,89 @@ $header-font: 'Alfa Slab One', serif;
33
33
--rust-logo-filter : initial ;
34
34
}
35
35
36
- // Dark theme
36
+ // Dark theme variables
37
+ :root {
38
+ --dark-theme-gray : #2a3439 ;
39
+ --dark-theme-red : #a72145 ;
40
+ --dark-theme-yellow : #ffc832 ;
41
+ --dark-theme-code-color : white ;
42
+ --dark-theme-code-bg-color : rgba (213 , 203 , 198 , 0.05 );
43
+ --dark-theme-code-border-color : rgba (213 , 203 , 198 , 0.25 );
44
+ --dark-theme-blockquote-color : rgb (195 , 205 , 210 );
45
+ --dark-theme-blockquote-bg-color : rgba (213 , 203 , 198 , 0.05 );
46
+ --dark-theme-blockquote-left-border-color : rgb (195 , 205 , 210 );
47
+ --dark-theme-body-background-color : #181a1b ;
48
+ --dark-theme-body-foreground-color : #e8e6e3 ;
49
+ --dark-theme-body-color : white ;
50
+ --dark-theme-div-brand-a-color : white ;
51
+ --dark-theme-white-elem-color : white ;
52
+ --dark-theme-white-elem-a : #d5cbc6 ;
53
+ --dark-theme-nav-links-a : #d5cbc6 ;
54
+ --dark-theme-publish-date-author : #d5cbc6 ;
55
+ --dark-theme-section-header-h2-color : white ;
56
+ --dark-theme-theme-icon : #43484d ;
57
+ --dark-theme-theme-popup-border : #43484d ;
58
+ --dark-theme-theme-popup-bg : #141617 ;
59
+ --dark-theme-theme-hover : #474c51 ;
60
+ --dark-theme-theme-choice-color : #d5cbc6 ;
61
+ --dark-theme-rust-logo-filter : drop-shadow (1px 0 0px #fff ) drop-shadow (0 1px 0 #fff ) drop-shadow (-1px 0 0 #fff ) drop-shadow (0 -1px 0 #fff );
62
+ }
63
+
64
+ // Obey dark theme system preference unless data-theme is set explicitly
65
+ @media (prefers-color-scheme : dark ) {
66
+ :root:not ([data-theme ]) {
67
+ --gray : var (--dark-theme-gray );
68
+ --red : var (--dark-theme-red );
69
+ --yellow : var (--dark-theme-yellow );
70
+ --code-color : var (--dark-theme-code-color );
71
+ --code-bg-color : var (--dark-theme-code-bg-color );
72
+ --code-border-color : var (--dark-theme-code-border-color );
73
+ --blockquote-color : var (--dark-theme-blockquote-color );
74
+ --blockquote-bg-color : var (--dark-theme-blockquote-bg-color );
75
+ --blockquote-left-border-color : var (--dark-theme-blockquote-left-border-color );
76
+ --body-background-color : var (--dark-theme-body-background-color );
77
+ --body-foreground-color : var (--dark-theme-body-foreground-color );
78
+ --body-color : var (--dark-theme-body-color );
79
+ --div-brand-a-color : var (--dark-theme-div-brand-a-color );
80
+ --white-elem-color : var (--dark-theme-white-elem-color );
81
+ --white-elem-a : var (--dark-theme-white-elem-a );
82
+ --nav-links-a : var (--dark-theme-nav-links-a );
83
+ --publish-date-author : var (--dark-theme-publish-date-author );
84
+ --section-header-h2-color : var (--dark-theme-section-header-h2-color );
85
+ --theme-icon : var (--dark-theme-theme-icon );
86
+ --theme-popup-border : var (--dark-theme-theme-popup-border );
87
+ --theme-popup-bg : var (--dark-theme-theme-popup-bg );
88
+ --theme-hover : var (--dark-theme-theme-hover );
89
+ --theme-choice-color : var (--dark-theme-theme-choice-color );
90
+ --rust-logo-filter : var (--dark-theme-rust-logo-filter );
91
+ }
92
+ }
93
+ // Set dark theme based on explicit data-theme setting
37
94
:root [data-theme = ' dark' ] {
38
- --gray : #2a3439 ;
39
- --red : #a72145 ;
40
- --yellow : #ffc832 ;
41
- --code-color : white ;
42
- --code-bg-color : rgba ( 213 , 203 , 198 , 0.05 );
43
- --code-border-color : rgba ( 213 , 203 , 198 , 0.25 );
44
- --blockquote-color : rgb ( 195 , 205 , 210 );
45
- --blockquote-bg-color : rgba ( 213 , 203 , 198 , 0.05 );
46
- --blockquote-left-border-color : rgb ( 195 , 205 , 210 );
47
- --body-background-color : #181a1b ;
48
- --body-foreground-color : #e8e6e3 ;
49
- --body-color : white ;
50
- --div-brand-a-color : white ;
51
- --white-elem-color : white ;
52
- --white-elem-a : #d5cbc6 ;
53
- --nav-links-a : #d5cbc6 ;
54
- --publish-date-author : #d5cbc6 ;
55
- --section-header-h2-color : white ;
56
- --theme-icon : #43484d ;
57
- --theme-popup-border : #43484d ;
58
- --theme-popup-bg : #141617 ;
59
- --theme-hover : #474c51 ;
60
- --theme-choice-color : #d5cbc6 ;
61
- --rust-logo-filter : drop-shadow ( 1 px 0 0 px #fff ) drop-shadow ( 0 1 px 0 #fff ) drop-shadow ( -1 px 0 0 #fff ) drop-shadow ( 0 -1 px 0 #fff );
95
+ --gray : var ( --dark-theme-gray ) ;
96
+ --red : var ( --dark-theme-red ) ;
97
+ --yellow : var ( --dark-theme-yellow ) ;
98
+ --code-color : var ( --dark-theme-code-color ) ;
99
+ --code-bg-color : var ( --dark-theme-code-bg-color );
100
+ --code-border-color : var ( --dark-theme-code-border-color );
101
+ --blockquote-color : var ( --dark-theme-blockquote-color );
102
+ --blockquote-bg-color : var ( --dark-theme-blockquote-bg-color );
103
+ --blockquote-left-border-color : var ( --dark-theme-blockquote-left-border-color );
104
+ --body-background-color : var ( --dark-theme-body-background-color ) ;
105
+ --body-foreground-color : var ( --dark-theme-body-foreground-color ) ;
106
+ --body-color : var ( --dark-theme-body-color ) ;
107
+ --div-brand-a-color : var ( --dark-theme-div-brand-a-color ) ;
108
+ --white-elem-color : var ( --dark-theme- white-elem-color ) ;
109
+ --white-elem-a : var ( --dark-theme-white-elem-a ) ;
110
+ --nav-links-a : var ( --dark-theme-nav-links-a ) ;
111
+ --publish-date-author : var ( --dark-theme-publish-date-author ) ;
112
+ --section-header-h2-color : var ( --dark-theme-section-header-h2-color ) ;
113
+ --theme-icon : var ( --dark-theme-theme-icon ) ;
114
+ --theme-popup-border : var ( --dark-theme-theme-popup-border ) ;
115
+ --theme-popup-bg : var ( --dark-theme-theme-popup-bg ) ;
116
+ --theme-hover : var ( --dark-theme-theme-hover ) ;
117
+ --theme-choice-color : var ( --dark-theme-theme-choice-color ) ;
118
+ --rust-logo-filter : var ( --dark-theme-rust-logo-filter );
62
119
}
63
120
64
121
html {
0 commit comments