Fix keyword color too similar to function color in 2026 themes - #331643
Open
srikanthananthula (srikanthananthula63053) wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the 2026 default themes to ensure control-flow keywords receive the same keyword coloring as other keywords.
Changes:
- Expanded the
scopeselector for keyword styling from a single"keyword"scope to an array including"keyword.control"in both light and dark themes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| extensions/theme-defaults/themes/2026-light.json | Adds keyword.control to the keyword color scope list for the light theme. |
| extensions/theme-defaults/themes/2026-dark.json | Adds keyword.control to the keyword color scope list for the dark theme. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The theme's own "keyword" rule (#ff7b72) was being shadowed by the more specific "keyword.control" rule inherited from dark_plus.json (#C586C0) for most real keywords (if/return/import/try/except/for/ while, etc.), since TextMate scope matching picks the most specific matching selector regardless of which theme defined it. That inherited magenta ends up visually very close to the theme's own entity.name.function color (#D2A8FF), which is what issue microsoft#331622 reports as "keyword color too similar to function color". Add "keyword.control" alongside "keyword" so the theme's intended coral-red wins for control-flow keywords, matching how the theme already resolves similar collisions for storage.modifier scopes. Fixes microsoft#331622
The same specificity shadowing described in the previous commit also affects 2026-light.json: the theme's "keyword" rule (#cf222e) was shadowed by light_plus.json's more specific "keyword.control" rule (#AF00DB), which sits close to this theme's entity.name.function color (#8250df). Apply the same fix for consistency, per microsoft#331622.
srikanthananthula (srikanthananthula63053)
force-pushed
the
fix-331622-2026-dark-theme-keyword-color
branch
from
August 19, 2026 14:28
9af1fce to
ed218ec
Compare
Mohammad javad Dianat (dianatofficial)
left a comment
There was a problem hiding this comment.
Great catch on this edge case. Fallback logic is robust.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #331622.
In the 2026 Dark Theme, keywords (
if,import,try,except,for,while, etc.) are visually hard to distinguish from function names, as reported with a screenshot in the issue.Root cause
2026-dark.jsondefines its owntokenColorsrule for the generic"keyword"scope (#ff7b72, coral-red). However,dark_plus.json(an ancestor via the themeincludechain:2026-dark.json→dark_modern.json→dark_plus.json) already defines a more specific rule for"keyword.control"(#C586C0, magenta).VS Code's TextMate scope matching always prefers the most specific matching selector, regardless of which theme in the include chain defined it. Since most real keywords use scopes like
keyword.control.flow.pythonorkeyword.control.import.python, they matchkeyword.control(2 segments) rather than the theme's ownkeyword(1 segment) rule — so the inherited#C586C0wins over the theme's intended#ff7b72.#C586C0(magenta) sits visually very close to the theme'sentity.name.functioncolor (#D2A8FF, lavender) — both are pastel purple/magenta tones on the same near-black background, which is exactly the collision reported in the issue.I confirmed this by downloading the screenshot attached to the issue and sampling its pixels directly:
import/from/asrender as#C586C0, while the called/imported function name renders as#D2A8FF.The same issue exists in
2026-light.json(keyword=#cf222e, shadowed bylight_plus.json'skeyword.control=#AF00DB, close to that theme'sentity.name.function=#8250df), so I fixed both for consistency.Fix
Minimal, one rule changed per theme: add
"keyword.control"alongside"keyword"in each theme's owntokenColors, so the theme's intended color wins for control-flow keywords too — the same pattern the theme already uses elsewhere (e.g. itsstorage.modifier.*overrides).{ - "scope": "keyword", + "scope": [ + "keyword", + "keyword.control" + ], "settings": { "foreground": "#ff7b72" } },(analogous change in
2026-light.jsonwith#cf222e)Validation
There are no existing automated tests asserting specific theme color values in this repo, so none were added — theme color changes are conventionally validated visually. To verify without a full Electron build, I wrote a small script that replicates the actual theme
include-merge and TextMate scope-specificity resolution logic fromcolorThemeData.ts, and confirmed:keyword.control.flow.python#C586C0#ff7b72keyword.control.import.python#C586C0#ff7b72entity.name.function#D2A8FF(unchanged)#D2A8FF(unchanged)I also rendered a before/after swatch confirming the visual improvement, and re-verified the equivalent scopes/colors for the light theme fix.
Test plan
git diffreviewed — only the two theme JSON files touched, one rule each