Skip to content

Commit a320792

Browse files
rsbhclaude
andcommitted
fix: consistent code block colors with shiki defaultColor: false
Use CSS variables only (no inline styles) for syntax highlighting. Both light and dark themes controlled via CSS selectors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c5d277e commit a320792

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

packages/chronicle/src/server/vite-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export async function createViteConfig(options: ViteConfigOptions): Promise<Inli
4141
remarkDirective,
4242
],
4343
rehypePlugins: [
44-
[rehypeShiki, { themes: { light: 'github-light', dark: 'github-dark' } }],
44+
[rehypeShiki, { themes: { light: 'github-light', dark: 'github-dark' }, defaultColor: false }],
4545
],
4646
mdExtensions: ['.md'],
4747
mdxExtensions: ['.mdx'],

packages/chronicle/src/themes/default/Page.module.css

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,22 @@
3838
margin-bottom: var(--rs-space-3);
3939
}
4040

41-
.content :global(pre code span) {
42-
color: var(--shiki-light);
41+
.content :global(pre) {
42+
background-color: var(--shiki-light-bg, #fff);
4343
}
4444

45-
:global([data-theme="dark"]) .content :global(pre code span) {
46-
color: var(--shiki-dark);
45+
.content :global(pre code span) {
46+
color: var(--shiki-light);
4747
}
4848

4949
:global([data-theme="dark"]) .content :global(pre) {
5050
background-color: var(--shiki-dark-bg, #24292e);
5151
}
5252

53+
:global([data-theme="dark"]) .content :global(pre code span) {
54+
color: var(--shiki-dark);
55+
}
56+
5357
.content img {
5458
max-width: 100%;
5559
height: auto;

0 commit comments

Comments
 (0)