Skip to content

Commit 02282bc

Browse files
Fix code snippet contrast in light mode using dual Shiki themes (#77)
* Initial plan * Initial plan for fixing code snippet contrast in light mode 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> * Fix code snippet contrast in light mode using dual Shiki themes 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> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
1 parent c12282a commit 02282bc

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

astro.config.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ import tailwindcss from '@tailwindcss/vite';
77
export default defineConfig({
88
site: 'https://devproxy.net',
99
base: '/',
10+
markdown: {
11+
shikiConfig: {
12+
themes: {
13+
light: 'github-light',
14+
dark: 'github-dark',
15+
},
16+
},
17+
},
1018
integrations: [
1119
astroConsent({
1220
siteName: 'This website',

src/styles/global.css

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,20 @@ body {
7373
tr { border-bottom: 1px solid var(--border-primary); }
7474
td { padding: 0.5rem 0.75rem; }
7575

76-
pre { background: var(--code-bg); border: 1px solid var(--code-border); border-radius: 0.5rem; padding: 1rem; overflow-x: auto; margin: 1rem 0; }
76+
pre { border: 1px solid var(--code-border); border-radius: 0.5rem; padding: 1rem; overflow-x: auto; margin: 1rem 0; }
7777
code { color: var(--code-text); }
78-
pre code { color: var(--code-block-text); }
78+
pre code { color: inherit; }
7979

8080
blockquote { border-left: 4px solid #a855f7; padding-left: 1rem; color: var(--text-muted); }
8181

8282
kbd { background: var(--bg-tertiary); padding: 0.125rem 0.5rem; border-radius: 0.25rem; font-size: 0.875rem; border: 1px solid var(--border-secondary); }
83+
}
84+
85+
.dark .astro-code,
86+
.dark .astro-code span {
87+
color: var(--shiki-dark) !important;
88+
background-color: var(--shiki-dark-bg) !important;
89+
font-style: var(--shiki-dark-font-style) !important;
90+
font-weight: var(--shiki-dark-font-weight) !important;
91+
text-decoration: var(--shiki-dark-text-decoration) !important;
8392
}

0 commit comments

Comments
 (0)