Skip to content

Commit f85f16a

Browse files
brandonkachenclaude
andcommitted
fix(cli): restore createMarkdownPalette function
Main branch requires this function for markdown rendering. Added back the function with proper imports that was removed in our cleanup. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent e06e80e commit f85f16a

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

cli/src/utils/theme-system.ts

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import { fileURLToPath } from 'url'
55
import { spawn } from 'child_process'
66
import { connect, type Socket } from 'net'
77

8-
import type { ThemeName } from '../types/theme-system'
8+
import type { ThemeName, ChatTheme as ChatThemeType, MarkdownHeadingLevel } from '../types/theme-system'
99
export type { ThemeName } from '../types/theme-system'
1010

11+
import type { MarkdownPalette } from './markdown-renderer'
1112
import { detectTerminalTheme, terminalLikelySupportsOSC } from './terminal-color-detection'
1213
import { logger } from './logger'
1314
import { detectIDETheme, getIDEThemeConfigPaths } from './theme-ide'
@@ -135,7 +136,34 @@ export const cloneChatTheme = (input: ChatTheme): ChatTheme => ({
135136
: undefined,
136137
})
137138

138-
// No markdown palette helpers; markdown renderer uses its own defaults.
139+
export const createMarkdownPalette = (theme: ChatTheme): MarkdownPalette => {
140+
const headingDefaults: Record<MarkdownHeadingLevel, string> = {
141+
1: theme.primary,
142+
2: theme.primary,
143+
3: theme.primary,
144+
4: theme.primary,
145+
5: theme.primary,
146+
6: theme.primary,
147+
}
148+
149+
const overrides = theme.markdown?.headingFg ?? {}
150+
151+
return {
152+
inlineCodeFg: theme.markdown?.inlineCodeFg ?? theme.foreground,
153+
codeBackground: theme.markdown?.codeBackground ?? theme.background,
154+
codeHeaderFg: theme.markdown?.codeHeaderFg ?? theme.secondary,
155+
headingFg: {
156+
...headingDefaults,
157+
...overrides,
158+
},
159+
listBulletFg: theme.markdown?.listBulletFg ?? theme.secondary,
160+
blockquoteBorderFg: theme.markdown?.blockquoteBorderFg ?? theme.secondary,
161+
blockquoteTextFg: theme.markdown?.blockquoteTextFg ?? theme.foreground,
162+
dividerFg: theme.markdown?.dividerFg ?? theme.secondary,
163+
codeTextFg: theme.markdown?.codeTextFg ?? theme.foreground,
164+
codeMonochrome: theme.markdown?.codeMonochrome ?? true,
165+
}
166+
}
139167

140168
// -----------------------------
141169
// Theme Resolution (no env mode)

0 commit comments

Comments
 (0)