Skip to content

Fix code snippet contrast in light mode using dual Shiki themes#77

Merged
waldekmastykarz merged 3 commits intomainfrom
copilot/fix-light-mode-contrast
Apr 16, 2026
Merged

Fix code snippet contrast in light mode using dual Shiki themes#77
waldekmastykarz merged 3 commits intomainfrom
copilot/fix-light-mode-contrast

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 16, 2026

Code blocks are unreadable in light mode — Shiki's default github-dark theme applies a dark background via inline styles that the CSS can't override, while pre 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 properties
  • src/styles/global.css:
    • Drop background from pre and change pre code color to inherit — let Shiki control these per-theme
    • Add .dark .astro-code rules to switch to --shiki-dark* custom properties when dark mode is active

Before / After (light mode)

Before After
before after

Dark mode remains unchanged:

dark

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
    • Triggering command: /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)
    • Triggering command: /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)
    • Triggering command: /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:

Copilot AI linked an issue Apr 16, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits April 16, 2026 08:15
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 AI changed the title [WIP] Fix contrast issue in code snippets for light mode Fix code snippet contrast in light mode using dual Shiki themes Apr 16, 2026
Copilot AI requested a review from waldekmastykarz April 16, 2026 08:21
@waldekmastykarz waldekmastykarz marked this pull request as ready for review April 16, 2026 08:26
@waldekmastykarz
Copy link
Copy Markdown
Member

@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

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 16, 2026

@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...

Verified on the v2.3 post which has a plain-text code block (the Dev Proxy started in background... snippet). The repo doesn't include a v2.3.1 post yet, but the v2.3 post has the same plain-text snippet type.

Before (light mode) — plain-text code block:
before

After (light mode) — plain-text code block:
after

After (dark mode) — plain-text code block:
dark

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
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/.npm/_npx/aa98e6899c6baff3/node_modules/.bin/astro build (dns block)
    • Triggering command: /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)
    • Triggering command: /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:

@waldekmastykarz waldekmastykarz merged commit 02282bc into main Apr 16, 2026
2 checks passed
@waldekmastykarz waldekmastykarz deleted the copilot/fix-light-mode-contrast branch April 16, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code snippets are unreadable

2 participants