Fix code snippet contrast in light mode using dual Shiki themes#77
Fix code snippet contrast in light mode using dual Shiki themes#77waldekmastykarz merged 3 commits intomainfrom
Conversation
Agent-Logs-Url: https://github.com/dev-proxy-tools/dev-proxy-tools.github.io/sessions/1e57e512-e6d3-4cd5-b3f8-7476bcd87054 Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Configure Astro to use github-light and github-dark Shiki themes with CSS toggling based on the .dark class. This ensures code blocks have proper contrast in both light and dark modes. Agent-Logs-Url: https://github.com/dev-proxy-tools/dev-proxy-tools.github.io/sessions/1e57e512-e6d3-4cd5-b3f8-7476bcd87054 Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
|
@copilot check in on a page that proves the fix like https://devproxy.net/blog/dev-proxy-v2-3-1-with-fixes-for-permissions-guidance-and-entra-mocking/ which has two plain-text snippets. Show me the before and after screenshots |
Verified on the v2.3 post which has a plain-text code block (the Before (light mode) — plain-text code block: After (light mode) — plain-text code block: After (dark mode) — plain-text code block: Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|



Code blocks are unreadable in light mode — Shiki's default
github-darktheme applies a dark background via inline styles that the CSS can't override, whilepre code { color }overrides Shiki's token colors with dark values, yielding dark-on-dark text.Changes
astro.config.mjs: Configure dual Shiki themes (github-light/github-dark) so Astro emits both color sets per token as inline styles + CSS custom propertiessrc/styles/global.css:backgroundfrompreand changepre codecolor toinherit— let Shiki control these per-theme.dark .astro-coderules to switch to--shiki-dark*custom properties when dark mode is activeBefore / After (light mode)
Dark mode remains unchanged:
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
telemetry.astro.build/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/dev-proxy-tools.github.io/dev-proxy-tools.github.io/node_modules/.bin/astro build(dns block)/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/dev-proxy-tools.github.io/dev-proxy-tools.github.io/node_modules/.bin/astro preview --host 0.0.0.0(dns block)/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/dev-proxy-tools.github.io/dev-proxy-tools.github.io/node_modules/.bin/astro preview(dns block)If you need me to access, download, or install something from one of these locations, you can either: