New to Claude Skills? Learn how to install them →

microsoft on GitHub

UX Theming

OfficialFree

Streamline your VS Code theming process with best practices.

by microsoft188.6k stars on microsoft/vscode
4 views
Updated Aug 10, 2026
Get this skill

Free · Opens the source repo

What UX Theming does

The UX Theming skill provides a comprehensive guide for developers looking to implement effective theming in Visual Studio Code. It covers essential aspects such as color registration, CSS variable usage, and widget styling patterns. This skill is particularly valuable for those who want to ensure their themes comply with accessibility standards, including high-contrast themes and focus indicators.

With this skill, you will learn how to register colors for different themes, including light, dark, and high-contrast options. The instructions emphasize the importance of using theme tokens and CSS variables to maintain consistency across your UI components. By adhering to these guidelines, you can create a visually appealing and accessible experience for users.

Additionally, the skill outlines best practices for defining focus indicators, ensuring that interactive elements are easily identifiable when navigated via keyboard. It also highlights the need to avoid hardcoded visual values, promoting the use of CSS variables for colors, shadows, and dimensions. This approach not only enhances maintainability but also aligns with modern design principles.

Whether you are a developer creating extensions or a designer working on custom themes, this skill serves as a valuable resource to enhance your theming capabilities in Visual Studio Code.

When to use it

Use this skill when developing themes or extensions for VS Code that require adherence to theming best practices and accessibility standards.

When not to use it

This skill may not be suitable for users who are not working within the VS Code environment or those who do not require a focus on accessibility in their themes.

What you can build with it

Creating a Custom Theme

Use this skill to guide the development of a custom VS Code theme, ensuring it meets accessibility standards.

Implementing Focus Indicators

Refer to the skill when adding focus indicators to your UI components for better keyboard navigation.

Ensuring High Contrast Compliance

Utilize the skill to confirm that your theme adheres to high-contrast requirements for users with visual impairments.

How to install UX Theming

View source

1. Install with the skills CLI

npx skills add microsoft/vscode/ux-theming --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by microsoft

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

export const myWidgetBackground = registerColor('myWidget.background',
    { light: '#ffffff', dark: '#252526', hcDark: Color.black, hcLight: Color.white },
    nls.localize('myWidgetBackground', "Background color of My Widget."));

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

FileColors
src/vs/platform/theme/common/colors/baseColors.tsforeground, focusBorder, contrastBorder, text links
src/vs/platform/theme/common/colors/editorColors.tsEditor widgets, find match, errors/warnings
src/vs/platform/theme/common/colors/inputColors.tsInput, toggle, validation
src/vs/platform/theme/common/colors/listColors.tsList/tree selection, focus, hover, drop
src/vs/platform/theme/common/colors/miscColors.tsBadge, scrollbar, progress bar, sash
src/vs/workbench/common/theme.tsTabs, sidebar, status bar, panels, editor groups, banner

3. Using Colors in CSS

Colors are injected as CSS custom properties on .monaco-workbench:

Color ID: editor.background
CSS variable: --vscode-editor-background
Usage: var(--vscode-editor-background)

Conversion functions in colorUtils.ts:

  • asCssVariable(colorId)'var(--vscode-editor-background)'
  • asCssVariableName(colorId)'--vscode-editor-background'

In CSS files, reference directly:

.my-widget {
    background-color: var(--vscode-editor-background);
    color: var(--vscode-foreground);
    border: 1px solid var(--vscode-contrastBorder);
}

4. Widget Styles Pattern

File: src/vs/platform/theme/browser/defaultStyles.ts

Every widget type has a default style object and an override factory:

// Use defaults:
const button = new Button(container, defaultButtonStyles);

// Override specific colors:
const button = new Button(container, getButtonStyles({
    buttonBackground: myCustomBackgroundColor
}));

Available defaults: defaultButtonStyles, defaultInputBoxStyles, defaultCheckboxStyles, defaultToggleStyles, defaultDialogStyles, defaultListStyles, defaultSelectBoxStyles, defaultMenuStyles, defaultProgressBarStyles, defaultCountBadgeStyles, defaultBreadcrumbsWidgetStyles, defaultKeybindingLabelStyles, defaultFindWidgetStyles.

5. Focus Indicators

Defined in src/vs/workbench/browser/media/style.css:

.my-widget:focus {
    outline-width: 1px;
    outline-style: solid;
    outline-offset: -1px;
    outline-color: var(--vscode-focusBorder);
}

Rules:

  • Use var(--vscode-focusBorder) — never hardcode a focus color.
  • Default outline-offset: -1px (inset). Exception: checkboxes use 2px.
  • Active elements suppress focus ring: .my-widget:active { outline: 0 !important; }
  • Use .synthetic-focus class for programmatic focus indication.
  • Toggle buttons use border: 1px dashed var(--vscode-focusBorder) instead of outline.

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 hcDark and hcLight defaults when registering colors.
  • HC backgrounds: Color.black (hcDark), Color.white (hcLight).
  • HC borders: reference contrastBorder — it is null in normal themes, visible in HC.
  • HC focus: use activeContrastBorder (derived from focusBorder).
  • In CSS, use .hc-black / .hc-light class selectors for HC-specific overrides:
    .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):
    .my-widget {
        box-shadow: 0 1px 3px var(--vscode-widget-shadow);
    }
    .vscode-high-contrast .my-widget {
        box-shadow: none;
        border: 1px solid var(--vscode-contrastBorder);
    }
    

7. No Hardcoded Visual Values

Reviewers will always flag hardcoded colors, shadows, sizes that should use theme tokens or CSS variables.

Hardcoded (flagged)Correct
rgba(0, 0, 0, 0.12)var(--vscode-widget-shadow) or theme-aware variable
#252526var(--vscode-editor-background)
color: whitevar(--vscode-button-foreground)
border: 1px solid #cccvar(--vscode-editorWidget-border)
border: 1px solid … (width)var(--vscode-strokeThickness) for the 1px width
border-radius: 6pxvar(--vscode-cornerRadius-medium) (radius ramp)
padding: 8px 12px (off-scale)spacing ramp (--vscode-spacing-size*)
font-size: 14px (arbitrary)size ramp (--vscode-fontSize-*, agents --vscode-agents-fontSize-*)
font-weight: 500--vscode-fontWeight-semiBold (agents --vscode-agents-fontWeight-semiBold; no 500)
codicon font-size: 14px--vscode-codiconFontSize (16) / -compact (12)

Rule: If a value relates to color, shadow, or border — it must come from a CSS variable or registered color token. The only exception is 0 (zero) values and purely structural measurements like 100%.

Size, spacing, radius, font and stroke values have their own design-system size tokens (and decision logic — snap maps, the pill→circle rule, and the compact-glyph convention). Those live in the ux-css-layout skill (§10 Design-System Size Tokens) and the auto-injected .github/instructions/design-tokens.instructions.md. Reach for those when a flag is about how big / how round / how bold something is rather than what color.


Key Files

AreaFile
Color registrationsrc/vs/platform/theme/common/colorUtils.ts
Color registry (barrel)src/vs/platform/theme/common/colorRegistry.ts
Base colorssrc/vs/platform/theme/common/colors/baseColors.ts
Workbench colorssrc/vs/workbench/common/theme.ts
Default widget stylessrc/vs/platform/theme/browser/defaultStyles.ts
Global workbench stylessrc/vs/workbench/browser/media/style.css

Frequently asked questions about UX Theming

Similar skills