Expose theme-resolved syntax/token colors to extensions (so webviews & custom views can match the editor exactly) #3106
Unanswered
NolanLT
asked this question in
Extension Development QnA
Replies: 1 comment 1 reply
-
|
Ok, let me work with you. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The gap
Extensions can already read structural theme colors (editor background, foreground, line numbers, etc.) — in webviews these arrive as
--vscode-*CSS variables, and viaThemeColorin the editor. But there is no way to get the active theme's syntax/token colors (keyword, string, comment, number, function, type…).That means anything an extension renders outside a normal text editor — a webview, a custom view, a minimap — cannot match the editor's syntax highlighting. Today the only options are:
Both are wasteful and fragile, and neither tracks the user's real theme.
Why it matters
This blocks a whole category of extensions:
What's already proposed
Two recent, well-scoped proposals would solve this issue:
ColorTheme: ask for "the keyword color", "the string color", etc. of the active theme. Lightweight; perfect for mapping a highlighter's tokens to real theme colors.They build on the long-standing requests #56356 (let extensions use the syntax highlighter — same webview use case) and #32813 (programmatic access to theme colors).
Either #319754 or #319753 landing would let extensions match the editor's syntax colors natively, drop their bundled highlighters, and follow theme changes for free.
How you can help
If this would help your extension (or you've hit it as a user), please 👍 the proposals so they don't get auto-closed for lack of interest:
A reaction on the issue's top post is what counts. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions