Skip to content

Commit 0ef3425

Browse files
landing: theme-aware code-sample colors so text reads in dark mode
The quickstart and step mini-code panes use --bg-inverse as their background — a deliberate visual inversion that turns black in light mode and near-white in dark mode. The text colors were hard-coded for the dark-bg case (#ededed, #6e6e6e, #d0d0d0, #b8b8b8, #fafafa), so in dark mode they painted near-white on a near-white card and the code disappeared. Introduced --code-text + --code-comment/string/keyword/function companion tokens that flip alongside --bg-inverse. Light mode keeps the previous pale-on-black palette; dark mode uses dark grays on the light card (text #1a1a1a, kw #525252, str #404040, cmt #8a8a8a, fn #0a0a0a) so each token has at least ~5:1 contrast against the #fafafa background.
1 parent 85f8fb9 commit 0ef3425

1 file changed

Lines changed: 32 additions & 10 deletions

File tree

‎public/index.html‎

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,18 @@
7979
--status: #1a7a4a;
8080
--warn: #b91c1c;
8181

82+
/* Syntax-highlighting tokens for the inverted code panes. The
83+
code card uses --bg-inverse as its background, which flips
84+
with the theme; these companion tokens flip too so the text
85+
is always readable against that bg. Tuned for the dark
86+
palette in light mode (bg #0a0a0a) and the light palette in
87+
dark mode (bg #fafafa). */
88+
--code-text: #ededed;
89+
--code-comment: #6e6e6e;
90+
--code-string: #d0d0d0;
91+
--code-keyword: #b8b8b8;
92+
--code-function: #fafafa;
93+
8294
--font-display: 'Fraunces', 'Times New Roman', serif;
8395
--font-body: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
8496
--font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
@@ -106,6 +118,11 @@
106118
--line: #262626;
107119
--line-strong: #404040;
108120
--line-inverse: #d4d4d4;
121+
--code-text: #1a1a1a;
122+
--code-comment: #8a8a8a;
123+
--code-string: #404040;
124+
--code-keyword: #525252;
125+
--code-function: #0a0a0a;
109126
}
110127
:root:not([data-theme="light"]) .nav { background: rgba(10,10,10,0.86); }
111128
:root:not([data-theme="light"]) .brand img,
@@ -126,6 +143,11 @@
126143
--line: #262626;
127144
--line-strong: #404040;
128145
--line-inverse: #d4d4d4;
146+
--code-text: #1a1a1a;
147+
--code-comment: #8a8a8a;
148+
--code-string: #404040;
149+
--code-keyword: #525252;
150+
--code-function: #0a0a0a;
129151
}
130152
:root[data-theme="dark"] .nav { background: rgba(10,10,10,0.86); }
131153
:root[data-theme="dark"] .brand img,
@@ -525,13 +547,13 @@
525547
font-family: var(--font-mono);
526548
font-size: 13px;
527549
line-height: 1.7;
528-
color: #ededed;
550+
color: var(--code-text);
529551
white-space: pre;
530552
}
531-
.code-pane .c-cmt { color: #6e6e6e; }
532-
.code-pane .c-str { color: #d0d0d0; }
533-
.code-pane .c-kw { color: #b8b8b8; }
534-
.code-pane .c-fn { color: #fafafa; }
553+
.code-pane .c-cmt { color: var(--code-comment); }
554+
.code-pane .c-str { color: var(--code-string); }
555+
.code-pane .c-kw { color: var(--code-keyword); }
556+
.code-pane .c-fn { color: var(--code-function); }
535557

536558
/* ───── How it works (steps + mini-code) ───── */
537559

@@ -566,18 +588,18 @@
566588
.step p { font-size: 14px; line-height: 1.6; color: var(--ink-2); }
567589
.step .mini-code {
568590
background: var(--bg-inverse);
569-
color: #ededed;
591+
color: var(--code-text);
570592
padding: 14px 16px;
571593
font-family: var(--font-mono);
572594
font-size: 12px;
573595
line-height: 1.7;
574596
overflow-x: auto;
575597
white-space: pre;
576598
}
577-
.step .mini-code .c-cmt { color: #6e6e6e; }
578-
.step .mini-code .c-str { color: #d0d0d0; }
579-
.step .mini-code .c-kw { color: #b8b8b8; }
580-
.step .mini-code .c-fn { color: #fafafa; }
599+
.step .mini-code .c-cmt { color: var(--code-comment); }
600+
.step .mini-code .c-str { color: var(--code-string); }
601+
.step .mini-code .c-kw { color: var(--code-keyword); }
602+
.step .mini-code .c-fn { color: var(--code-function); }
581603

582604
/* ───── Features grid ───── */
583605

0 commit comments

Comments
 (0)