@@ -5,9 +5,10 @@ import { fileURLToPath } from 'url'
55import { spawn } from 'child_process'
66import { 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'
99export type { ThemeName } from '../types/theme-system'
1010
11+ import type { MarkdownPalette } from './markdown-renderer'
1112import { detectTerminalTheme , terminalLikelySupportsOSC } from './terminal-color-detection'
1213import { logger } from './logger'
1314import { 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