Skip to content

Commit 5106bec

Browse files
Siddhi TripathiSiddhi Tripathi
authored andcommitted
website: apply theme variables and add toggle UI
- Update _sass/_base.scss to use CSS custom properties - Update _sass/_layout.scss to use theme variables - Apply consistent theming across site components This is step 3 of 3 for dark mode implementation.
1 parent b60308a commit 5106bec

File tree

2 files changed

+25
-20
lines changed

2 files changed

+25
-20
lines changed

_sass/_base.scss

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ dl, dd, ol, ul, figure {
1717
*/
1818
body {
1919
font: $base-font-weight list.slash($base-font-size, $base-line-height) $base-font-family;
20-
color: $text-color;
21-
background-color: $background-color;
20+
color: var(--text-primary);
21+
background-color: var(--bg-primary);
2222
-webkit-text-size-adjust: 100%;
2323
-webkit-font-feature-settings: "kern" 1;
2424
-moz-font-feature-settings: "kern" 1;
2525
-o-font-feature-settings: "kern" 1;
2626
font-feature-settings: "kern" 1;
2727
font-kerning: normal;
28+
transition: background-color 0.3s ease, color 0.3s ease;
2829
}
2930

3031

@@ -93,15 +94,15 @@ h1, h2, h3, h4, h5, h6 {
9394
* Links
9495
*/
9596
a {
96-
color: $brand-color;
97+
color: var(--link-color);
9798
text-decoration: none;
9899

99100
&:visited {
100-
color: darken($brand-color, 15%);
101+
color: var(--link-color);
101102
}
102103

103104
&:hover {
104-
color: $text-color;
105+
color: var(--link-hover);
105106
text-decoration: underline;
106107
}
107108
}
@@ -112,8 +113,8 @@ a {
112113
* Blockquotes
113114
*/
114115
blockquote {
115-
color: $grey-color;
116-
border-left: 4px solid $grey-color-light;
116+
color: var(--text-secondary);
117+
border-left: 4px solid var(--border-color);
117118
padding-left: $spacing-unit * 0.5;
118119
font-size: 18px;
119120
letter-spacing: -1px;
@@ -132,9 +133,9 @@ blockquote {
132133
pre,
133134
code {
134135
font-size: 15px;
135-
border: 1px solid $grey-color-light;
136+
border: 1px solid var(--border-color);
136137
border-radius: 3px;
137-
background-color: #eef;
138+
background-color: var(--code-bg);
138139
}
139140

140141
code {
@@ -202,7 +203,7 @@ pre {
202203
vertical-align: middle;
203204

204205
path {
205-
fill: $grey-color;
206+
fill: var(--text-secondary);
206207
}
207208
}
208209
}

_sass/_layout.scss

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
* Site header
33
*/
44
.site-header {
5-
border-top: 5px solid $grey-color-dark;
6-
border-bottom: 1px solid $grey-color-light;
5+
border-top: 5px solid var(--header-bg);
6+
border-bottom: 1px solid var(--border-color);
77
min-height: 56px;
8+
background-color: var(--header-bg);
9+
color: var(--header-text);
810

911
// Positioning context for the mobile navigation icon
1012
position: relative;
@@ -20,7 +22,7 @@
2022

2123
&,
2224
&:visited {
23-
color: $grey-color-dark;
25+
color: var(--header-text);
2426
}
2527
}
2628

@@ -33,7 +35,7 @@
3335
}
3436

3537
.page-link {
36-
color: $text-color;
38+
color: var(--header-text);
3739
line-height: $base-line-height;
3840

3941
// Gaps between nav items, but not on the last one
@@ -46,8 +48,8 @@
4648
position: absolute;
4749
top: 9px;
4850
right: $spacing-unit * 0.5;
49-
background-color: $background-color;
50-
border: 1px solid $grey-color-light;
51+
background-color: var(--bg-primary);
52+
border: 1px solid var(--border-color);
5153
border-radius: 5px;
5254
text-align: right;
5355

@@ -65,7 +67,7 @@
6567
height: 15px;
6668

6769
path {
68-
fill: $grey-color-dark;
70+
fill: var(--header-text);
6971
}
7072
}
7173
}
@@ -98,8 +100,10 @@
98100
* Site footer
99101
*/
100102
.site-footer {
101-
border-top: 1px solid $grey-color-light;
103+
border-top: 1px solid var(--border-color);
102104
padding: $spacing-unit 0;
105+
background-color: var(--footer-bg);
106+
color: var(--footer-text);
103107
}
104108

105109
.footer-heading {
@@ -115,7 +119,7 @@
115119

116120
.footer-col-wrapper {
117121
font-size: 15px;
118-
color: $grey-color;
122+
color: var(--footer-text);
119123
margin-left: -$spacing-unit * 0.5;
120124
@extend %clearfix;
121125
}
@@ -186,7 +190,7 @@
186190

187191
.post-meta {
188192
font-size: $small-font-size;
189-
color: $grey-color;
193+
color: var(--text-secondary);
190194
}
191195

192196
.post-link {

0 commit comments

Comments
 (0)