microsoft/vscode/ux-theming
Claude Code and agent skill by microsoft/vscode
- vendor
Checking that the SKILL.md file is still in the repository.
VS Code theming, color tokens, composited surfaces, interaction-state precedence, and high-contrast support. Use when styling widgets, changing hover/focus/selection, or validating rendered theme states.
Install
npx vskill@latest install microsoft/vscode/ux-themingSKILL.md
The same SKILL.md was published earlier as microsoft/vscode/ux-theming.
This skill covers color registration, CSS variable usage, widget style patterns, focus indicators, and high-contrast theme requirements.
1. Registering Colors
File: src/vs/platform/theme/common/colorUtils.ts
Rules:
- Provide defaults for all four theme types:
light,dark,hcDark,hcLight. - HC themes must use solid colors (avoid transparency) and set explicit borders via
contrastBorder. - Use color transforms for derived colors:
transparent(),darken(),lighten(),oneOf(). - Reference existing colors when possible instead of hardcoding hex values.
2. Color Categories
| File | Colors | |
|---|---|---|
src/vs/platform/theme/common/colors/baseColors.ts | foreground, focusBorder, contrastBorder, text links | |
src/vs/platform/theme/common/colors/editorColors.ts | Editor widgets, find match, errors/warnings | |
src/vs/platform/theme/common/colors/inputColors.ts | Input, toggle, validation | |
src/vs/platform/theme/common/colors/listColors.ts | List/tree selection, focus, hover, drop | |
src/vs/platform/theme/common/colors/miscColors.ts | Badge, scrollbar, progress bar, sash | |
src/vs/workbench/common/theme.ts | Tabs, sidebar, status bar, panels, editor groups, banner |
3. Using Colors in CSS
Colors are injected as CSS custom properties on .monaco-workbench:
Conversion functions in colorUtils.ts:
asCssVariable(colorId)→'var(--vscode-editor-background)'asCssVariableName(colorId)→'--vscode-editor-background'
In CSS files, reference directly:
Trace the rendered control before choosing a token or selector; custom editor overlays may not use native input pseudo-elements. Inspect inherited and nested styles as well as the component's own declarations.
Contrast and Interaction States
- Treat foreground and background as a semantic pair. A background change requires checking text, placeholders, links, operable inactive icons, hover, selection, and focus against the final composited surface.
- Resolve defaults, opacity, and user overrides before measuring contrast. For example, an opaque icon color may meet contrast requirements while its translucent inactive variant does not.
- Normal-size text and placeholders need at least 4.5:1 contrast; visual information needed to identify controls and focus needs at least 3:1 against adjacent colors. Apply the relevant accessibility criteria rather than extending these thresholds to decorative or disabled content. Unselected but operable controls are not disabled.
- Check nested labels and descriptions in combined states; an explicit child foreground can defeat a correctly paired selection background.
- Choose tokens by semantic role, not their current hue. A chart accent is not automatically a warning-button background, and pairing it with a default button foreground does not establish contrast. Reuse an appropriate control palette or register a themeable foreground/background pair when the component has its own semantics.
Composited Surfaces
A theme variable is not necessarily opaque. For a floating panel that must conceal underlying content, inspect the resolved alpha and all material layers rather than assuming a panel token or var() fallback guarantees occlusion. Use the owning theme/color helpers to derive an opaque semantic background where needed, preserve the intended glass treatment elsewhere, and verify switching content and floating/docked modes on the same instance.
Keep material paint separate from interactive descendants. Border-box and padding-box alignment, clipping, and duplicated translucent strokes are covered by rounded-surface geometry.
4. Widget Styles Pattern
File: src/vs/platform/theme/browser/defaultStyles.ts
Every widget type has a default style object and an override factory:
Available defaults: defaultButtonStyles, defaultInputBoxStyles, defaultCheckboxStyles, defaultToggleStyles, defaultDialogStyles, defaultListStyles, defaultSelectBoxStyles, defaultMenuStyles, defaultProgressBarStyles, defaultCountBadgeStyles, defaultBreadcrumbsWidgetStyles, defaultKeybindingLabelStyles, defaultFindWidgetStyles.
Transient Theme Overrides
Use the owning theme service for temporary palettes so CSS variables and programmatic color consumers remain consistent. Keep overrides scoped to the intended window and preserve the base theme and user customizations.
Verify enabling, disabling, replacement, disposal, and theme changes, including stale asynchronous results. Clearing an override must restore the original colors without persisting generated values or changing another window's theme or startup colors.
Color provenance and consumer coverage
Before changing a color fallback, distinguish the registered default, an explicit theme value, a user customization, and a temporary overlay. They are not interchangeable:
- Preserve the owning component's precedence contract. Adding a theme default can bypass an existing fallback to a user-customizable legacy token; test no customization, legacy-only customization, and both legacy and new tokens using the loaded theme.
- Do not infer explicit theme intent from a resolved color alone: resolution may include registry defaults or transient overlays. A fix for an active-tab theme color must not automatically change inactive, hover, or transparent-action compositing.
- Keep independent semantic roles independently customizable. For example, hiding editor diagnostic squiggles with transparent user colors must not hide Debug Console messages; preserve explicit console overrides and theme-defined diagnostic defaults.
- Trace every paint path. A scoped CSS variable does not update a theme-service lookup, an inline concrete color, a terminal canvas, or a detached Test Results terminal. Use the owning shared resolver where appropriate and subscribe affected consumers to the real runtime invalidation.
- For a new border color, check border presence, style, width, and layout reservation as well as color. A correctly resolved color cannot paint a border whose owner sets
noneor zero width. Include themes where the old border token is absent. - Validate moved views in both sidebars and the panel, preserving their location-specific and peek palettes. Use strongly contrasting test colors so an old-colored embedded surface cannot pass unnoticed.
- Measure the actual painted state and token: a horizontal Activity Bar uses different foreground tokens from the vertical bar; opacity and underlying surfaces affect the result. A faint selection fill does not prove that its boundary remains distinguishable.
5. Focus Indicators
Defined in src/vs/workbench/browser/media/style.css:
Rules:
- Use
var(--vscode-focusBorder)— never hardcode a focus color. - Default
outline-offset: -1px(inset). Exception: checkboxes use2px. - Preserve the owning widget's keyboard-focus mechanism, including supported
.focus-visibleor.synthetic-focusclasses. Pointer activation should not leave an unnecessary keyboard ring, but broad:activesuppression must not erase the boundary during keyboard activation. - Toggle selection, pointer hover, and keyboard focus are different states; do not use a dashed focus border as a universal toggle rule. Follow the interaction-state contract.
- Check keyboard focus independently from selection and hover, including ordinary links without explicit
tabindexand icon-only controls. Inspect computed outlines and pseudo-elements under production styles; token registration alone does not establish visibility. - Preserve a clear focus boundary through clipping and modal wrappers. Resolve competing border/outline ownership rather than adding duplicate rings or removing focus visibility.
Focus Trapping
Modal dialogs must trap focus within the dialog until dismissed. Use dom.trackFocus() and handle Tab/Shift+Tab cycling.
6. High Contrast Theme Rules
- Always provide
hcDarkandhcLightdefaults when registering colors. - HC surface backgrounds: use the registered HC defaults, commonly
Color.black(hcDark) andColor.white(hcLight). Preserve component-specific selection and control palettes. - HC borders: reference
contrastBorder— it isnullin normal themes, visible in HC. - HC keyboard focus: use
focusBorderor the owning list's focus token; reservecontrastActiveBorderfor the interaction states below. - In CSS, use
.hc-black/.hc-lightclass selectors for HC-specific overrides:
``css .hc-black .my-widget { border: 1px solid var(--vscode-contrastBorder); } ``
- In TypeScript, check
isHighContrast(theme.type)for runtime behavior changes. - Box shadows must be removed or replaced in HC mode (shadows are invisible/distracting with high contrast borders):
``css .my-widget { box-shadow: 0 1px 3px var(--vscode-widget-shadow); } .monaco-workbench:is(.hc-black, .hc-light) .my-widget { box-shadow: none; border: 1px solid var(--vscode-contrastBorder); } ``
High-Contrast Interaction-State Contract
Interaction boundaries communicate different semantics. Do not collapse hover, keyboard focus, selection, and persistent state into one generic rule.
| State | Boundary | Required behavior | |
|---|---|---|---|
| Pointer hover | Dashed contrastActiveBorder | Apply only to the actionable element actually under the pointer. A mouse-navigation class plus a stale focused row is not sufficient. | |
| Keyboard focus | Solid focusBorder or the owning list focus token | Must win over simultaneous hover and open/expanded/pressed state. Preserve the focus ring when the pointer remains over the control. | |
| Open, expanded, or pressed | Solid contrastActiveBorder | Persistent state, not transient hover. Keep normal-theme hover fill separate so an expanded control can respond to the pointer without becoming dashed. | |
| Selected or checked | The component's selection palette and semantic foreground | Hover must not replace the selected background while leaving the selected foreground behind. | |
| Disabled | No hover or active boundary | Disabled styling remains owned by the component. A disabled control that intentionally remains keyboard-focusable still needs a focus indicator. |
Assign one boundary owner per interaction. A pseudo-element may paint an inset hover fill, but it must not also draw an outline when the component root owns the boundary. When a card contains independent actions, suppress the card boundary while a nested action is hovered, focused, or open. For virtualized trees, inspect both the .monaco-list-row and its painted child such as .monaco-tl-row; never clear the child focus ring when the outer row's outline is intentionally suppressed.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 7 Sep 2026.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.github/skills/ux-theming/SKILL.md
Popularity
- Repository stars
- 191,449
- Repository forks
- 42,038
- 7-day trend score
- 61
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/microsoft/vscode/ux-theming)