Skip to content
Tutorials Center
My learning

Topics

Lesson 36 of 40 ยท Customization and Productivity

Custom Themes and Settings Profiles

Change colors with themes and workbench.colorCustomizations, tune syntax with tokenColorCustomizations, set icon themes, and bundle settings in VS Code Profiles.

You will look at your editor for thousands of hours, so it is worth making it comfortable. VS Code separates appearance into several layers: the color theme (colors for the interface and code), the file icon theme, the product icon theme and fine-grained overrides in settings. Another feature, Profiles, bundles settings, extensions, keybindings and snippets into switchable sets, so a "Writing" setup and a "Teaching" setup can coexist.

The stand-ins below are plain JavaScript: one checks color contrast, the other merges layers of settings. Neither runs inside VS Code.

Color themes and icon themes

  • Color Theme: Ctrl+K Ctrl+T, or Preferences: Color Theme. Arrow keys preview each theme live. Built-in choices include Dark Modern, Light Modern, Dark+ and several high-contrast themes. Thousands more are on the Marketplace.
  • Automatic switching: window.autoDetectColorScheme follows the operating system's dark or light mode, with workbench.preferredDarkColorTheme and workbench.preferredLightColorTheme naming the two themes.
  • File Icon Theme: Preferences: File Icon Theme changes the icons in the Explorer and tabs; the Material Icon Theme is a popular extension.
  • Product Icon Theme: changes the interface icons (Activity Bar, toolbar).

High-contrast themes and the setting window.zoomLevel are real accessibility tools, not only preferences. Pick what you can read comfortably for hours.

Customizing colors in settings

You can override single colors without writing a whole theme. Use workbench.colorCustomizations for the interface:

JSON
{
  "workbench.colorCustomizations": {
    "editor.background": "#1b1e24",
    "statusBar.background": "#7a3e9d",
    "activityBar.background": "#14161a",
    "editorCursor.foreground": "#ffcc00"
  }
}

To limit overrides to one theme, wrap them in the theme name:

JSON
{
  "workbench.colorCustomizations": {
    "[Default Dark Modern]": { "editor.background": "#101114" }
  }
}

Find color keys with Developer: Generate Color Theme From Current Settings or in the Theme Color reference of the documentation. A practical trick: put a different status bar color in each project's .vscode/settings.json. Then you see at a glance which window you are in, which prevents editing the wrong project.

Syntax colors

Code colors are TextMate scopes and semantic tokens. Override them with editor.tokenColorCustomizations:

JSON
{
  "editor.tokenColorCustomizations": {
    "textMateRules": [
      { "scope": "comment", "settings": { "foreground": "#7f8c8d", "fontStyle": "italic" } },
      { "scope": ["keyword.control", "storage.type"], "settings": { "foreground": "#ff7b72" } }
    ]
  },
  "editor.semanticTokenColorCustomizations": {
    "rules": { "function": "#d2a8ff" }
  }
}

To learn which scope a piece of code has, run Developer: Inspect Editor Tokens and Scopes and click the token. It shows the TextMate scopes and the semantic token type at once.

Fonts and ligatures

JSON
{
  "editor.fontFamily": "'Cascadia Code', Consolas, monospace",
  "editor.fontSize": 14,
  "editor.fontLigatures": true,
  "editor.lineHeight": 1.5,
  "editor.cursorBlinking": "smooth",
  "editor.cursorSmoothCaretAnimation": "on"
}

Font names with spaces need inner quotes. List fallbacks in order; the first font installed on your computer is used. Install the font in the operating system before naming it.

Settings Profiles

A Profile is a named set of: settings, keyboard shortcuts, user snippets, tasks, extensions and UI state. Create one with Profiles: Create Profile..., or from the gear icon > Profiles. Use cases:

  • By language: a "Python" profile with Python extensions and a "Web" profile with web ones, so each window loads only what it needs.
  • By role: a "Teaching" profile with a large font and a high-contrast theme.
  • Clean testing: a profile with no extensions to check whether a problem is caused by one.

You can assign a profile to a workspace, so opening a folder switches automatically. Profiles can be exported to a file or shared by link and imported on another computer. Settings Sync (the gear icon > Turn on Settings Sync, signed in with a Microsoft or GitHub account) keeps your settings, extensions, keybindings and snippets in step across devices; you choose what to sync, and it replaces the old habit of copying folders by hand.

Treat an imported profile like any code: check which extensions it installs.

Workspace settings win

Settings come in layers. From weakest to strongest: defaults, User settings, Remote settings, Workspace settings (.vscode/settings.json), and folder settings in multi-root workspaces. Language-specific [lang] blocks beat general entries at the same layer. A project can therefore enforce editor.tabSize for everyone, while your own preferences apply everywhere else.

Runnable stand-ins

JS Stand-in: check color contrast

Press Run (or Ctrl + Enter) to see the console output here.

No output.

JS Stand-in: settings layers

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which setting overrides individual interface colors?

    colorCustomizations changes interface colors; tokenColorCustomizations is for syntax colors.
  2. 2. How can you find the scope of a piece of code to restyle it?

    The inspector shows the TextMate scopes and semantic token type for the token you click.
  3. 3. What does a Profile contain?

    A profile bundles several customizations so you can switch between sets.
  4. 4. Which settings layer is stronger: User or Workspace?

    Workspace settings override User settings, so a project can enforce its own conventions.

Summary

  • Pick a color theme, icon theme and product icon theme; follow the OS mode automatically if you like.
  • Override interface colors with workbench.colorCustomizations and syntax with editor.tokenColorCustomizations.
  • Per-project status bar colors make it obvious which window you are in.
  • Profiles bundle settings, extensions, keybindings and snippets; Settings Sync shares them across devices.
  • Workspace settings override user settings; language blocks override general ones.

Next: Productivity Workflows