Skip to content

Commit e45c994

Browse files
Improve styles for light/dark
1 parent da9b6c1 commit e45c994

File tree

1 file changed

+50
-43
lines changed

1 file changed

+50
-43
lines changed

demo/styles.css

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@
55
/* Base Layout
66
========================================================================== */
77

8+
:root {
9+
color-scheme: light dark;
10+
}
11+
812
body {
913
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
1014
Oxygen, Ubuntu, Cantarell, sans-serif;
1115
line-height: 1.6;
12-
color: #333;
16+
color: CanvasText;
17+
background: Canvas;
1318
max-width: 1400px;
1419
margin: 0 auto;
1520
padding: 1rem;
@@ -37,7 +42,7 @@ h1 {
3742
h2 {
3843
font-size: 1.5rem;
3944
margin-block: 2rem 1rem;
40-
border-bottom: 2px solid #e0e0e0;
45+
border-bottom: 2px solid;
4146
padding-bottom: 0.5rem;
4247
}
4348

@@ -51,7 +56,7 @@ p {
5156
}
5257

5358
code {
54-
background: #f5f5f5;
59+
background: ButtonFace;
5560
padding: 0.125rem 0.25rem;
5661
border-radius: 3px;
5762
font-family: 'Courier New', Courier, monospace;
@@ -62,10 +67,18 @@ code {
6267
========================================================================== */
6368

6469
a {
65-
color: #0066cc;
70+
color: LinkText;
6671
text-decoration-skip-ink: auto;
6772
}
6873

74+
a:visited {
75+
color: VisitedText;
76+
}
77+
78+
a:active {
79+
color: ActiveText;
80+
}
81+
6982
a:hover {
7083
text-decoration: underline;
7184
}
@@ -79,14 +92,13 @@ header {
7992

8093
header p {
8194
font-size: 1.1rem;
82-
color: #666;
8395
}
8496

8597
footer {
8698
margin-block-start: 3rem;
8799
padding-block-start: 2rem;
88-
border-top: 2px solid #e0e0e0;
89-
color: #666;
100+
border-top: 2px solid ButtonBorder;
101+
color: GrayText;
90102
font-size: 0.9rem;
91103
}
92104

@@ -96,13 +108,13 @@ footer {
96108
.demo-section {
97109
margin-block: 2rem;
98110
padding: 1.5rem;
99-
background: #fafafa;
111+
background: ButtonFace;
100112
border-radius: 8px;
101-
border: 1px solid #e0e0e0;
113+
border: 1px solid ButtonBorder;
102114
}
103115

104116
.demo-section > p {
105-
color: #666;
117+
color: CanvasText;
106118
margin-block-end: 1rem;
107119
}
108120

@@ -136,14 +148,14 @@ footer {
136148
========================================================================== */
137149

138150
pre {
139-
background: #282c34;
140-
color: #abb2bf;
151+
background: Field;
152+
color: FieldText;
141153
padding: 1rem;
142154
border-radius: 6px;
143155
overflow-x: auto;
144156
margin: 0;
145157
font-size: 0.875rem;
146-
line-height: 1.5;
158+
line-height: 1.3;
147159
}
148160

149161
pre code {
@@ -153,12 +165,9 @@ pre code {
153165
font-size: inherit;
154166
}
155167

156-
/* Syntax Highlighting for Component
157-
========================================================================== */
158-
159168
pre code mark {
160-
background: rgba(97, 175, 239, 0.2);
161-
color: #6ac0ff;
169+
background: Mark;
170+
color: MarkText;
162171
border-radius: 2px;
163172
padding: 0.125rem 0.25rem;
164173
font-weight: 600;
@@ -168,10 +177,10 @@ pre code mark {
168177
========================================================================== */
169178

170179
.demo {
171-
background: white;
180+
background: Canvas;
172181
padding: 1rem;
173182
border-radius: 6px;
174-
border: 1px solid #ddd;
183+
border: 1px solid ButtonBorder;
175184
}
176185

177186
/* Form Elements
@@ -212,27 +221,27 @@ select,
212221
textarea {
213222
display: block;
214223
padding: 0.25rem 0.5rem;
215-
border: 1px solid #ccc;
224+
border: 1px solid ButtonBorder;
216225
border-radius: 4px;
217226
font-size: 1rem;
218227
font-family: inherit;
219228
width: 100%;
220229
max-width: 400px;
230+
background: Field;
231+
color: FieldText;
221232
}
222233

223-
input:focus,
224-
select:focus,
225-
textarea:focus {
226-
outline: 2px solid #0066cc;
234+
:focus-visible {
235+
outline: 2px solid AccentColor;
227236
outline-offset: 2px;
228-
border-color: #0066cc;
237+
border-color: AccentColor;
229238
}
230239

231240
button[type='submit'],
232241
button[type='reset'] {
233-
background: #0066cc;
234-
color: white;
235-
border: none;
242+
background: ButtonFace;
243+
color: ButtonText;
244+
border: 1px solid ButtonBorder;
236245
padding: 0.75rem 1.5rem;
237246
border-radius: 4px;
238247
font-size: 1rem;
@@ -244,23 +253,15 @@ button[type='reset'] {
244253

245254
button[type='submit']:hover,
246255
button[type='reset']:hover {
247-
background: #0052a3;
248-
}
249-
250-
button[type='reset'] {
251-
background: #666;
252-
}
253-
254-
button[type='reset']:hover {
255-
background: #555;
256+
opacity: 0.8;
256257
}
257258

258259
small {
259260
display: block;
260261
font-style: italic;
261262
font-weight: normal;
262263
margin-block: 0.5rem 1rem;
263-
color: #666;
264+
color: GrayText;
264265
}
265266

266267
/* Radio/Checkbox "Other" Pattern
@@ -290,8 +291,9 @@ small {
290291
========================================================================== */
291292

292293
.note {
293-
background: #fff3cd;
294-
border-left: 4px solid #ffc107;
294+
background: Mark;
295+
color: MarkText;
296+
border-left: 4px solid AccentColor;
295297
padding: 1rem;
296298
margin-block: 1rem;
297299
border-radius: 4px;
@@ -306,8 +308,9 @@ small {
306308
========================================================================== */
307309

308310
.api-reference {
309-
background: #e3f2fd;
310-
border-left: 4px solid #2196f3;
311+
background: SelectedItem;
312+
color: SelectedItemText;
313+
border-left: 4px solid AccentColor;
311314
padding: 1rem;
312315
margin-block: 2rem;
313316
border-radius: 4px;
@@ -316,3 +319,7 @@ small {
316319
.api-reference p {
317320
margin: 0;
318321
}
322+
323+
.api-reference a {
324+
color: inherit;
325+
}

0 commit comments

Comments
 (0)