Problem
The xshd-based syntax highlighting engine (ported from AvaloniaEdit) hardcodes colors directly in each language definition file. For example, CSharp-Mode.xshd specifies:
<Color name="Comment" foreground="Green" />
<Color name="Keyword" foreground="Blue" />
<Color name="String" foreground="Blue" />
Users have no way to customize these colors at runtime. If someone wants comments to be dark green instead of green, they must edit the .xshd file.
The old TextMateSyntaxHighlighter supported theme switching (DarkPlus, LightPlus, Monokai, etc.) via a ThemeName dropdown. That capability was lost when we moved to the xshd engine.
Proposed Solution
Add a color palette / theme indirection layer between the xshd named colors and the rendered output:
- Define a
IHighlightingTheme (or similar) interface that maps semantic color names (Comment, Keyword, String, etc.) to actual Attribute / foreground+background values.
- Ship a few built-in themes (e.g.,
Dark, Light) as simple name-to-color mappings.
- Have
HighlightingColorizer resolve colors through the active theme instead of using the xshd values directly. Fall back to the xshd-specified color if the theme doesn't define an override.
- Expose an
Editor.HighlightingTheme property (or similar) so users can switch themes at runtime.
- Restore the theme dropdown in
ted's status bar.
Infrastructure Already in Place
The xshd engine already uses semantic named colors (NamedHighlightingColors, GetNamedColor()). The mapping surface exists — we just need the indirection layer.
Acceptance Criteria
Problem
The xshd-based syntax highlighting engine (ported from AvaloniaEdit) hardcodes colors directly in each language definition file. For example,
CSharp-Mode.xshdspecifies:Users have no way to customize these colors at runtime. If someone wants comments to be dark green instead of green, they must edit the
.xshdfile.The old
TextMateSyntaxHighlightersupported theme switching (DarkPlus, LightPlus, Monokai, etc.) via aThemeNamedropdown. That capability was lost when we moved to the xshd engine.Proposed Solution
Add a color palette / theme indirection layer between the xshd named colors and the rendered output:
IHighlightingTheme(or similar) interface that maps semantic color names (Comment,Keyword,String, etc.) to actualAttribute/ foreground+background values.Dark,Light) as simple name-to-color mappings.HighlightingColorizerresolve colors through the active theme instead of using the xshd values directly. Fall back to the xshd-specified color if the theme doesn't define an override.Editor.HighlightingThemeproperty (or similar) so users can switch themes at runtime.ted's status bar.Infrastructure Already in Place
The xshd engine already uses semantic named colors (
NamedHighlightingColors,GetNamedColor()). The mapping surface exists — we just need the indirection layer.Acceptance Criteria
teddemo has a theme selector in the status bar