.kilo/plans/jetbrains-mdview-editor-theme-colors.md
Keep JetBrains markdown layout compact while making markdown colors and backgrounds come from the active editor color scheme, and ensure existing theme/editor-setting listeners refresh all existing MdView instances after changes.
SessionUi already subscribes to EditorColorsManager.TOPIC and LafManagerListener.TOPIC, then calls applyStyle(SessionEditorStyle.current()) on the session tree.MdView.applyStyle(style) via TextView, ReasoningView, message lists, and session panels.PlanExitView.applyStyle() sets only font/code font/foreground and does not call md.applyStyle(style), so internal markdown role colors can stay tied to the initial style.MdViewHybrid.applyStyle() restyles retained HTML panes and code block containers, but retained CodeField editors need explicit reapplication of SessionEditorStyle.applyToEditor() after creation so syntax highlighting and editor colors follow scheme changes.MdCommon.defaults() currently mixes editor colors, UI theme colors, and one literal inline-code color fallback. The literal fallback should be removed, and markdown roles should derive from EditorColorsScheme/syntax attributes wherever possible.TextView currently overrides markdown background with SessionUiStyle.Transcript.bgColor() (UiStyle.Colors.bg()), while prompt markdown already uses style.editorBackground. If markdown surfaces should consistently use editor background, normal text views need to use style.editorBackground too.Keep compact CSS unchanged.
Derive markdown role defaults from editor settings.
MdCommon.defaults(style) to use style.editorForeground and style.editorBackground for primary text/background.style.editorScheme.getAttributes(key) and color keys from style.editorScheme.getColor(key).CodeInsightColors.HYPERLINK_ATTRIBUTES.foregroundColor, fallback to platform link color if absent.DefaultLanguageHighlighterColors.DOC_CODE_INLINE, fallback to STRING, then editor foreground/background.DefaultLanguageHighlighterColors.DOC_CODE_BLOCK, fallback to editor foreground/background.UIUtil.getContextHelpForeground() only when the scheme has no useful value.EditorColors.PREVIEW_BORDER_COLOR, fallback to UiStyle.Colors.contentBorder().JBColor(0x...) or other literal runtime color fallbacks from MdCommon.MdView API unchanged; role colors stay internal unless a concrete external override need appears.Ensure style propagation reaches every markdown instance.
PlanExitView.applyStyle(style) to call md.applyStyle(style) before applying its explicit font/code-font/foreground overrides.SessionEditorStyleTarget propagation path rather than adding per-MdView theme listeners.TextView, ReasoningView, and PlanExitView where they intentionally set body text role, but let internal markdown role colors refresh from the new style snapshot.Ensure retained hybrid code blocks update after editor setting changes.
MdViewHybrid.CodeView.style(opts), for retained CodeField blocks, reapply style.applyToEditor(editor) to the underlying editor if it exists.opts.preBg in the same path.Align markdown backgrounds with editor settings.
MdCommon default background as style.editorBackground.TextView markdown background to style.editorBackground if the intent is that all markdown surfaces use editor background, matching PromptView and session root behavior.transparent handling: when md.opaque = false, background should still be the editor-derived value for child/code surfaces, but the Swing component should remain non-opaque.Update tests.
MdViewTest to verify markdown role CSS changes when applying a SessionEditorStyle backed by a customized editor scheme, especially inline code, code block, link, and border colors.MdViewHybridTest to assert applyStyle() updates retained HTML panes and retained code editors without replacing them, including editor scheme/background changes.PlanExitViewTest so applyStyle() refreshes the nested markdown style, not just foreground/font overrides.packages/kilo-jetbrains/, run ./gradlew frontend:test --tests '*MdView*'.packages/kilo-jetbrains/, run ./gradlew frontend:test --tests '*PlanExitViewTest*' if the focused test is not covered by the MdView filter.packages/kilo-jetbrains/, run bun run typecheck.MdView; use the existing SessionUi listener and SessionEditorStyleTarget propagation path.MdViewHybrid.sync() component reuse.MdView override API stable unless implementation proves a new external override is required.