Skip to content

Commit 7633dca

Browse files
committed
fix: dark mode code block styling
chore: fmt
1 parent e2304f6 commit 7633dca

File tree

3 files changed

+145
-138
lines changed

3 files changed

+145
-138
lines changed

_sass/_base.scss

Lines changed: 122 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,216 +1,221 @@
11
/**
22
* Reset some basic elements
33
*/
4-
body, h1, h2, h3, h4, h5, h6,
5-
p, blockquote, pre, hr,
6-
dl, dd, ol, ul, figure {
7-
margin: 0;
8-
padding: 0;
4+
body,
5+
h1,
6+
h2,
7+
h3,
8+
h4,
9+
h5,
10+
h6,
11+
p,
12+
blockquote,
13+
pre,
14+
hr,
15+
dl,
16+
dd,
17+
ol,
18+
ul,
19+
figure {
20+
margin: 0;
21+
padding: 0;
922
}
1023

11-
12-
1324
/**
1425
* Basic styling
1526
*/
1627
body {
17-
overflow-y: scroll;
18-
font-family: $base-font-family;
19-
font-size: $base-font-size;
20-
line-height: $base-line-height;
21-
font-weight: 300;
22-
color: $text-color;
23-
background-color: $background-color;
24-
-webkit-text-size-adjust: 100%;
28+
overflow-y: scroll;
29+
font-family: $base-font-family;
30+
font-size: $base-font-size;
31+
line-height: $base-line-height;
32+
font-weight: 300;
33+
color: $text-color;
34+
background-color: $background-color;
35+
-webkit-text-size-adjust: 100%;
2536
}
2637

27-
28-
2938
/**
3039
* Set `margin-bottom` to maintain vertical rhythm
3140
*/
32-
h1, h2, h3, h4, h5, h6,
33-
p, blockquote, pre,
34-
ul, ol, dl, figure,
41+
h1,
42+
h2,
43+
h3,
44+
h4,
45+
h5,
46+
h6,
47+
p,
48+
blockquote,
49+
pre,
50+
ul,
51+
ol,
52+
dl,
53+
figure,
3554
%vertical-rhythm {
36-
margin-bottom: $spacing-unit / 1.5;
55+
margin-bottom: $spacing-unit / 1.5;
3756
}
3857

39-
4058
/**
4159
* Images
4260
*/
4361
img {
44-
max-width: 100%;
45-
height: auto;
46-
vertical-align: middle;
62+
max-width: 100%;
63+
height: auto;
64+
vertical-align: middle;
4765
}
4866

49-
50-
5167
/**
5268
* Figures
5369
*/
5470
figure > img {
55-
display: block;
71+
display: block;
5672
}
5773

5874
figcaption {
59-
font-size: $small-font-size;
75+
font-size: $small-font-size;
6076
}
6177

62-
63-
6478
/**
6579
* Lists
6680
*/
67-
ul, ol {
68-
margin-left: $spacing-unit;
81+
ul,
82+
ol {
83+
margin-left: $spacing-unit;
6984
}
7085

7186
li {
72-
> ul,
73-
> ol {
74-
margin-bottom: 0;
75-
}
87+
> ul,
88+
> ol {
89+
margin-bottom: 0;
90+
}
7691
}
7792

78-
79-
8093
/**
8194
* Headings
8295
*/
83-
h1, h2, h3, h4, h5, h6 {
84-
font-weight: 300;
96+
h1,
97+
h2,
98+
h3,
99+
h4,
100+
h5,
101+
h6 {
102+
font-weight: 300;
85103
}
86104

87105
h1.post-title {
88-
color: #486391;
106+
color: #486391;
89107
}
90108

91-
92109
/**
93110
* Links
94111
*/
95112
a {
96-
color: $brand-color;
97-
text-decoration: underline;
113+
color: $brand-color;
114+
text-decoration: underline;
98115

99-
&:visited {
100-
color: darken($brand-color, 15%);
101-
}
116+
&:visited {
117+
color: darken($brand-color, 15%);
118+
}
102119

103-
&:hover {
104-
color: $text-color;
105-
text-decoration: underline;
106-
}
120+
&:hover {
121+
color: $text-color;
122+
text-decoration: underline;
123+
}
107124
}
108125

109-
110-
111126
/**
112127
* Blockquotes
113128
*/
114129
blockquote {
115-
color: $grey-color;
116-
border-left: 4px solid $grey-color-light;
117-
padding-left: $spacing-unit / 2;
118-
font-size: 18px;
119-
letter-spacing: -1px;
120-
font-style: italic;
130+
color: $grey-color;
131+
border-left: 4px solid $grey-color-light;
132+
padding-left: $spacing-unit / 2;
133+
font-size: 18px;
134+
letter-spacing: -1px;
135+
font-style: italic;
121136

122-
> :last-child {
123-
margin-bottom: 0;
124-
}
137+
> :last-child {
138+
margin-bottom: 0;
139+
}
125140
}
126141

127-
128-
129142
/**
130143
* Code formatting
131144
*/
132145
pre,
133146
code {
134-
font-size: 15px;
135-
border: 1px solid $grey-color-light;
136-
border-radius: 3px;
137-
background-color: #f5f5f5;
147+
border: 1px solid $grey-color-light;
148+
border-radius: 8px;
149+
background-color: #f5f5f5;
138150
}
139151

140152
code {
141-
padding: 1px 5px;
153+
padding: 1px 5px;
154+
font-size: 0.9em;
142155
}
143156

144157
pre {
145-
padding: 8px 12px;
146-
overflow-x: scroll;
158+
padding: 1em;
159+
overflow-x: scroll;
147160

148-
> code {
149-
border: 0;
150-
padding-right: 0;
151-
padding-left: 0;
152-
}
161+
> code {
162+
border: 0;
163+
padding-right: 0;
164+
padding-left: 0;
165+
}
153166
}
154167

155-
156-
157168
/**
158169
* Wrapper
159170
*/
160171
.wrapper {
161-
max-width: -webkit-calc(#{$content-width} - (#{$spacing-unit} * 2));
162-
max-width: calc(#{$content-width} - (#{$spacing-unit} * 2));
163-
margin-right: auto;
164-
margin-left: auto;
165-
padding-right: $spacing-unit;
166-
padding-left: $spacing-unit;
167-
padding-top: $spacing-unit;
168-
@extend %clearfix;
169-
170-
@include media-query($on-laptop) {
171-
max-width: -webkit-calc(#{$content-width} - (#{$spacing-unit}));
172-
max-width: calc(#{$content-width} - (#{$spacing-unit}));
173-
padding-right: $spacing-unit / 2;
174-
padding-left: $spacing-unit / 2;
175-
}
172+
max-width: -webkit-calc(#{$content-width} - (#{$spacing-unit} * 2));
173+
max-width: calc(#{$content-width} - (#{$spacing-unit} * 2));
174+
margin-right: auto;
175+
margin-left: auto;
176+
padding-right: $spacing-unit;
177+
padding-left: $spacing-unit;
178+
padding-top: $spacing-unit;
179+
@extend %clearfix;
180+
181+
@include media-query($on-laptop) {
182+
max-width: -webkit-calc(#{$content-width} - (#{$spacing-unit}));
183+
max-width: calc(#{$content-width} - (#{$spacing-unit}));
184+
padding-right: $spacing-unit / 2;
185+
padding-left: $spacing-unit / 2;
186+
}
176187
}
177188

178-
179-
180189
/**
181190
* Clearfix
182191
*/
183192
%clearfix {
184-
185-
&:after {
186-
content: "";
187-
display: table;
188-
clear: both;
189-
}
193+
&:after {
194+
content: "";
195+
display: table;
196+
clear: both;
197+
}
190198
}
191199

192-
193-
194200
/**
195201
* Icons
196202
*/
197203
.icon {
204+
> svg {
205+
display: inline-block;
206+
width: 16px;
207+
height: 16px;
208+
vertical-align: middle;
198209

199-
> svg {
200-
display: inline-block;
201-
width: 16px;
202-
height: 16px;
203-
vertical-align: middle;
204-
205-
path {
206-
fill: $grey-color;
207-
}
210+
path {
211+
fill: $grey-color;
208212
}
213+
}
209214
}
210215

211216
.ai-text-block {
212-
background-color: #fff3e6;
213-
padding: 1em;
214-
margin: 1em 0;
215-
border-radius: 4px;
217+
background-color: #fff3e6;
218+
padding: 1em;
219+
margin: 1em 0;
220+
border-radius: 4px;
216221
}

_sass/_dark-mode.scss

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,13 @@ body.dark-mode {
4141

4242
pre,
4343
code {
44-
background-color: #2d2d2d;
45-
border-color: #7fbfff;
44+
background-color: #404040 !important;
45+
border-color: #404040;
46+
color: #e0e0e0;
47+
}
48+
49+
code {
50+
color: #000;
4651
}
4752
.post-meta {
4853
color: #bbb;

0 commit comments

Comments
 (0)