microsoft / microsoft/WinAppVSCE
XAML: Show color swatches for named colors (e.g. Red, CornflowerBlue)
Open
@chiaramooney is already working on this.
Since Sep 8, 2026.
enhancement
- Dominant language
- TypeScript
- Stars
- 13
- Forks
- 3
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 11
Description
Summary
The XAML language server currently shows color swatches only for hex color literals (e.g. #FF0000). Named WinUI colors like Red, CornflowerBlue, DarkSlateGray should also display inline color swatches in the editor.
Current state
XamlColor.csparses hex literals and returnsColorInformationto the LSP clientXamlTypeSystem.GetNamedColors()already discovers named color constants via Roslyn (e.g.Microsoft.UI.Colors.Red)- However, Roslyn cannot evaluate property getters at design time, so the actual RGBA values for named colors are not available from the type system alone
Proposed approach
Import a build-time lookup table of named color → RGBA mappings from the WinAppSDK source (or a generated resource). This table would be used by XamlColor to resolve named colors to their swatch values without requiring runtime evaluation.
Related
- PR #50 (XAML language service integration)
server/src/WinUiXaml.LanguageServer/XamlColor.csserver/src/WinUiXaml.Workspace/XamlTypeSystem.cs
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.