Skip to content

Commit 0277bf6

Browse files
committed
style: force preview text colors using explicit tailwind modifiers to fix visibility
1 parent 049fca7 commit 0277bf6

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

src/app/globals.css

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,32 @@ body {
9898
::-webkit-scrollbar-thumb:hover {
9999
background-color: var(--foreground);
100100
}
101+
102+
/* Typography Overrides to match theme */
103+
.prose {
104+
--tw-prose-body: var(--foreground);
105+
--tw-prose-headings: var(--foreground);
106+
--tw-prose-lead: var(--muted-foreground);
107+
--tw-prose-links: var(--primary);
108+
--tw-prose-bold: var(--foreground);
109+
--tw-prose-counters: var(--muted-foreground);
110+
--tw-prose-bullets: var(--muted-foreground);
111+
--tw-prose-hr: var(--border);
112+
--tw-prose-quotes: var(--foreground);
113+
--tw-prose-quote-borders: var(--border);
114+
--tw-prose-captions: var(--muted-foreground);
115+
--tw-prose-code: var(--foreground);
116+
--tw-prose-pre-code: var(--card-foreground);
117+
--tw-prose-pre-bg: var(--secondary);
118+
--tw-prose-th-borders: var(--border);
119+
--tw-prose-td-borders: var(--border);
120+
121+
/* Invert (Dark Mode) overrides - mapped to same variables because our variables already switch values in dark mode!
122+
BUT prose-invert switches to use --tw-prose-invert-*, so we need to set those too if we use prose-invert.
123+
HOWEVER, since our variables (like --foreground) ALREADY switch based on .dark class,
124+
we actually DON'T want prose-invert to flip them again (which usually flips light gray to dark gray).
125+
126+
If we use our dynamic variables, we might not even need 'dark:prose-invert' if we just let the variables handle it.
127+
Let's try removing 'dark:prose-invert' from the component and rely on these variables.
128+
*/
129+
}

src/components/preview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ interface PreviewProps {
1616
export function MarkdownPreview({ content, className }: PreviewProps) {
1717
return (
1818
<div className={cn("h-full w-full overflow-y-auto p-4 bg-background text-foreground transition-colors duration-200", className)}>
19-
<article className="prose dark:prose-invert max-w-none prose-pre:bg-transparent prose-pre:p-0">
19+
<article className="prose max-w-none prose-headings:text-foreground prose-p:text-foreground prose-strong:text-foreground prose-li:text-foreground prose-ul:text-foreground prose-ol:text-foreground prose-pre:bg-transparent prose-pre:p-0">
2020
<ReactMarkdown
2121
remarkPlugins={[remarkGfm, remarkMath]}
2222
rehypePlugins={[rehypeKatex, rehypeHighlight]}

0 commit comments

Comments
 (0)