Skip to content

Commit e0ab4b1

Browse files
brabojclaude
andauthored
fix: make code blocks respond to dark mode theme toggle (#200)
Replace hardcoded colors in .content pre with CSS variables (--color-code-bg, --color-code-fg) that adapt to the selected theme. Closes #159 Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f0de5be commit e0ab4b1

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

astro-site/src/styles/global.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
--color-border: #0000001f;
2020
--color-link: #00796b;
2121
--color-focus: #00796b;
22+
--color-code-bg: #f5f5f5;
23+
--color-code-fg: #212121;
2224

2325
/* Spacing */
2426
--space-xs: 0.25rem;
@@ -55,6 +57,8 @@
5557
--color-border: #ffffff1f;
5658
--color-link: #4dd0e1;
5759
--color-focus: #4dd0e1;
60+
--color-code-bg: #2a2a2a;
61+
--color-code-fg: #e0e0e0;
5862
}
5963

6064
/* Reset */
@@ -531,8 +535,8 @@ a:hover {
531535
}
532536

533537
.content pre {
534-
background: #1e1e1e;
535-
color: #e0e0e0;
538+
background: var(--color-code-bg);
539+
color: var(--color-code-fg);
536540
border-radius: 4px;
537541
padding: var(--space-md);
538542
margin-bottom: var(--space-lg);

0 commit comments

Comments
 (0)