Skip to content

Commit 65f859e

Browse files
committed
Sharpen dark mode typography
1 parent 4f0dcdb commit 65f859e

2 files changed

Lines changed: 35 additions & 16 deletions

File tree

apps/dev-preview/src/styles.css

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
:root {
22
color-scheme: light;
33
font-family:
4-
"Avenir Next", Avenir, "Segoe UI", ui-sans-serif, system-ui, -apple-system,
5-
BlinkMacSystemFont, sans-serif;
4+
-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, ui-sans-serif,
5+
system-ui, sans-serif;
66
font-size: 17px;
77
font-synthesis: none;
88
--canvas: #f7f3ea;
@@ -83,8 +83,9 @@ body {
8383
margin: 0;
8484
background: var(--canvas);
8585
color: var(--ink);
86+
-webkit-font-smoothing: antialiased;
8687
line-height: 1.65;
87-
text-rendering: optimizeLegibility;
88+
text-rendering: auto;
8889
}
8990

9091
button,
@@ -142,7 +143,7 @@ button {
142143
.brand {
143144
color: var(--ink);
144145
font-size: 1.05rem;
145-
font-weight: 750;
146+
font-weight: 700;
146147
letter-spacing: -0.025em;
147148
text-decoration: none;
148149
}
@@ -261,7 +262,7 @@ h3 {
261262
margin: 0.85rem 0 0;
262263
font-family: ui-serif, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
263264
font-size: 1rem;
264-
font-weight: 650;
265+
font-weight: 600;
265266
line-height: 1.35;
266267
}
267268

@@ -315,14 +316,14 @@ h3 {
315316
gap: 0.1rem;
316317
min-width: 0;
317318
font-size: 0.83rem;
318-
font-weight: 650;
319+
font-weight: 600;
319320
line-height: 1.35;
320321
}
321322

322323
.lesson-link-copy small {
323324
color: var(--muted);
324325
font-size: 0.68rem;
325-
font-weight: 550;
326+
font-weight: 500;
326327
}
327328

328329
.locked-lesson {
@@ -362,7 +363,7 @@ h3 {
362363
background: var(--surface);
363364
color: var(--ink);
364365
cursor: pointer;
365-
font-weight: 650;
366+
font-weight: 600;
366367
}
367368

368369
.guided-tools button:hover,
@@ -479,7 +480,7 @@ h3 {
479480
border-radius: var(--radius-sm);
480481
background: var(--primary);
481482
color: var(--on-primary);
482-
font-weight: 750;
483+
font-weight: 700;
483484
text-decoration: none;
484485
}
485486

@@ -502,7 +503,7 @@ h3 {
502503
margin: 0 0 0.25rem;
503504
color: var(--primary);
504505
font-size: 0.78rem;
505-
font-weight: 750;
506+
font-weight: 700;
506507
}
507508

508509
.track-title,
@@ -559,7 +560,7 @@ h3 {
559560
margin: 0;
560561
color: var(--primary);
561562
font-size: 0.78rem;
562-
font-weight: 750;
563+
font-weight: 700;
563564
}
564565

565566
.course-card h3 {
@@ -604,7 +605,7 @@ h3 {
604605
padding: 0.45rem 0;
605606
color: var(--muted);
606607
font-size: 0.84rem;
607-
font-weight: 650;
608+
font-weight: 600;
608609
}
609610

610611
.lesson {
@@ -632,7 +633,7 @@ h3 {
632633
.eyebrow {
633634
color: var(--primary);
634635
font-size: 0.79rem;
635-
font-weight: 750;
636+
font-weight: 700;
636637
letter-spacing: 0.015em;
637638
}
638639

@@ -758,7 +759,7 @@ pre {
758759
color: var(--muted);
759760
font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
760761
font-size: 0.72rem;
761-
font-weight: 750;
762+
font-weight: 700;
762763
}
763764

764765
.checkpoint-current .checkpoint-marker,
@@ -883,7 +884,7 @@ pre code {
883884
background: var(--surface);
884885
color: var(--ink);
885886
cursor: pointer;
886-
font-weight: 650;
887+
font-weight: 600;
887888
}
888889

889890
.lesson-pagination button:hover:not(:disabled) {
@@ -982,7 +983,7 @@ pre code {
982983
.compact-course-contents > summary small {
983984
color: var(--muted);
984985
font-size: 0.75rem;
985-
font-weight: 550;
986+
font-weight: 500;
986987
}
987988

988989
.contents-chevron {

tests/browser/course.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,24 @@ test("follows the system theme, syncs explorables, and persists an override", as
8888
sage: "#25372f",
8989
primary: "#b4d9c3",
9090
});
91+
const typography = await page.evaluate(() => {
92+
const body = getComputedStyle(document.body);
93+
const action = document.querySelector<HTMLElement>(".library-primary-action");
94+
if (!action) throw new Error("Expected the primary course action");
95+
const primaryAction = getComputedStyle(action);
96+
return {
97+
fontFamily: body.fontFamily,
98+
fontSmoothing: body.getPropertyValue("-webkit-font-smoothing"),
99+
textRendering: body.textRendering,
100+
primaryActionWeight: primaryAction.fontWeight,
101+
};
102+
});
103+
expect(typography.fontFamily).not.toContain("Avenir");
104+
expect(typography).toMatchObject({
105+
fontSmoothing: "antialiased",
106+
textRendering: "auto",
107+
primaryActionWeight: "700",
108+
});
91109
expect((await new AxeBuilder({ page }).analyze()).violations).toEqual([]);
92110

93111
await page.getByRole("button", { name: "Dark mode" }).click();

0 commit comments

Comments
 (0)