From cffdca4be0b6492d5b823e69522b92aab6d0919e Mon Sep 17 00:00:00 2001 From: Branimir Georgiev Date: Sun, 26 Apr 2026 13:26:51 +0300 Subject: [PATCH] fix: make code blocks respond to dark mode theme toggle 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) --- astro-site/src/styles/global.css | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/astro-site/src/styles/global.css b/astro-site/src/styles/global.css index 5a3a5bc..90df62a 100644 --- a/astro-site/src/styles/global.css +++ b/astro-site/src/styles/global.css @@ -19,6 +19,8 @@ --color-border: #0000001f; --color-link: #00796b; --color-focus: #00796b; + --color-code-bg: #f5f5f5; + --color-code-fg: #212121; /* Spacing */ --space-xs: 0.25rem; @@ -55,6 +57,8 @@ --color-border: #ffffff1f; --color-link: #4dd0e1; --color-focus: #4dd0e1; + --color-code-bg: #2a2a2a; + --color-code-fg: #e0e0e0; } /* Reset */ @@ -531,8 +535,8 @@ a:hover { } .content pre { - background: #1e1e1e; - color: #e0e0e0; + background: var(--color-code-bg); + color: var(--color-code-fg); border-radius: 4px; padding: var(--space-md); margin-bottom: var(--space-lg);