Skip to content

Commit c2c11cf

Browse files
groksrcclaude
andcommitted
Fix dark mode visibility issues across documentation site
- Configure dual themes for Shiki syntax highlighting (github-light/github-dark) - Add CSS overrides for code blocks to ensure proper dark mode colors - Fix Card component headings with explicit dark mode text colors - Configure Mermaid with proper dark theme support and text colors - Add CSS overrides for Mermaid flowchart edges and arrow markers - Ensure proper contrast in both light (#333) and dark (#ccc) modes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent ad0c0e9 commit c2c11cf

File tree

3 files changed

+83
-6
lines changed

3 files changed

+83
-6
lines changed

astro.config.mjs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,27 @@ import mermaid from 'astro-mermaid';
88

99
// https://astro.build/config
1010
export default defineConfig({
11-
integrations: [mdx(), react(), pagefind(), mermaid()],
11+
integrations: [mdx(), react(), pagefind(), mermaid({
12+
themes: {
13+
light: 'default',
14+
dark: 'base'
15+
},
16+
mermaidConfig: {
17+
themeVariables: {
18+
darkMode: true,
19+
primaryTextColor: '#f3f4f6',
20+
secondaryTextColor: '#e5e7eb',
21+
tertiaryTextColor: '#d1d5db'
22+
}
23+
}
24+
})],
1225
markdown: {
1326
syntaxHighlight: 'shiki',
1427
shikiConfig: {
15-
theme: 'github-light',
28+
themes: {
29+
light: 'github-light',
30+
dark: 'github-dark'
31+
},
1632
wrap: false
1733
}
1834
}

src/components/Card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default function Card({ title, icon, href, children, className }: CardPro
2828
</div>
2929
)}
3030
<div className="flex-1">
31-
<h3 className="mb-2 text-lg font-medium leading-none tracking-tight">
31+
<h3 className="mb-2 text-lg font-medium leading-none tracking-tight text-gray-900 dark:text-gray-100">
3232
{title}
3333
</h3>
3434
{children && (

src/styles/global.css

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@
8282
}
8383

8484
p {
85-
@apply leading-7 [&:not(:first-child)]:mt-6;
86-
color: #3e3e3e;
85+
@apply leading-7 [&:not(:first-child)]:mt-6 text-gray-700 dark:text-gray-300;
8786
font-size: 16px;
8887
}
8988

@@ -100,7 +99,7 @@
10099
}
101100

102101
li {
103-
color: #3e3e3e;
102+
@apply text-gray-700 dark:text-gray-300;
104103
}
105104

106105
code {
@@ -171,6 +170,42 @@
171170
@apply bg-gray-200 dark:bg-gray-800 px-1 rounded;
172171
}
173172

173+
/* Override inline styles for Shiki code blocks in dark mode */
174+
.dark pre.astro-code {
175+
background-color: rgb(17 24 39) !important; /* dark:bg-gray-900 */
176+
}
177+
178+
.dark pre.astro-code,
179+
.dark pre.astro-code span {
180+
color: rgb(243 244 246) !important; /* dark:text-gray-100 */
181+
}
182+
183+
/* Preserve token colors in dark mode */
184+
.dark pre.astro-code .token.keyword {
185+
color: rgb(147 197 253) !important; /* blue-300 */
186+
}
187+
188+
.dark pre.astro-code .token.string {
189+
color: rgb(134 239 172) !important; /* green-300 */
190+
}
191+
192+
.dark pre.astro-code .token.comment {
193+
color: rgb(156 163 175) !important; /* gray-400 */
194+
}
195+
196+
.dark pre.astro-code .token.function {
197+
color: rgb(252 211 77) !important; /* yellow-300 */
198+
}
199+
200+
.dark pre.astro-code .token.number {
201+
color: rgb(251 146 60) !important; /* orange-400 */
202+
}
203+
204+
.dark pre.astro-code .token.operator,
205+
.dark pre.astro-code .token.punctuation {
206+
color: rgb(209 213 219) !important; /* gray-300 */
207+
}
208+
174209
a {
175210
@apply font-medium text-primary hover:text-primary/80;
176211
}
@@ -268,4 +303,30 @@
268303
-webkit-box-orient: vertical;
269304
overflow: hidden;
270305
}
306+
307+
/* Prevent Tailwind dark mode styles from affecting Mermaid diagrams */
308+
.mermaid p {
309+
color: inherit !important;
310+
}
311+
312+
/* Mermaid line colors for light and dark modes */
313+
.mermaid .flowchart-link {
314+
stroke: #333333 !important;
315+
}
316+
317+
.dark .mermaid .flowchart-link {
318+
stroke: #cccccc !important;
319+
}
320+
321+
/* Mermaid arrow markers for light and dark modes */
322+
.mermaid marker path {
323+
fill: #333333 !important;
324+
stroke: #333333 !important;
325+
}
326+
327+
.dark .mermaid marker path {
328+
fill: #cccccc !important;
329+
stroke: #cccccc !important;
330+
}
331+
271332
}

0 commit comments

Comments
 (0)