Skip to content

evanheckert/code-language-theme-selector

Repository files navigation

Code Language Theme Selector

Automatically switch your VS Code color theme based on the programming language of your active file.

Features

This extension allows you to:

  • Define specific color themes for different programming languages
  • Automatically switch themes when you change between files of different languages
  • Easily add, remove, and view your language-theme mappings
  • View the current language and theme mapping in the status bar
  • Temporarily enable or disable the extension
  • Configure mappings via settings.json

When you open a file, the extension detects the language and applies your preferred theme for that language.

How to Use

Adding a Language-Theme Mapping

  1. Press Ctrl+Shift+P (or Cmd+Shift+P on macOS) to open the Command Palette
  2. Type and select Language Theme Selector: Add Language-Theme Mapping
  3. Select a language from the dropdown list
  4. Select your preferred theme for that language

Removing a Mapping

  1. Press Ctrl+Shift+P (or Cmd+Shift+P on macOS) to open the Command Palette
  2. Type and select Language Theme Selector: Remove Language-Theme Mapping
  3. Select the mapping you want to remove

Viewing Current Mappings

  1. Press Ctrl+Shift+P (or Cmd+Shift+P on macOS) to open the Command Palette
  2. Type and select Language Theme Selector: Show Current Mappings

Status Bar Indicator

The extension shows the current language and its associated theme in the status bar. Click on the status bar item to view all your current mappings.

Toggling the Extension

If you want to temporarily disable the automatic theme switching:

  1. Press Ctrl+Shift+P (or Cmd+Shift+P on macOS) to open the Command Palette
  2. Type and select Language Theme Selector: Toggle Enable/Disable

This will turn the extension on or off without losing your mappings.

Configuration via settings.json

You can configure language-theme mappings directly in your settings.json file. This is particularly useful for:

  • Configuring the same theme for multiple languages at once
  • Setting a default theme for languages without specific mappings
  • Sharing your configuration across multiple machines

Example Configuration

{
  "code-language-theme-selector.defaultTheme": "Default Dark+",
  "code-language-theme-selector.languageMappings": [
    {
      "languageIds": [
        "typescript",
        "javascript",
        "typescriptreact",
        "javascriptreact"
      ],
      "colorTheme": "GitHub Dark"
    },
    {
      "languageIds": ["python"],
      "colorTheme": "Monokai"
    },
    {
      "languageIds": ["markdown"],
      "colorTheme": "Light+"
    }
  ]
}

Available Settings

  • code-language-theme-selector.defaultTheme: The theme to use for languages without a specific mapping
  • code-language-theme-selector.languageMappings: An array of language-theme mapping objects
    • Each mapping has languageIds (array of language identifiers) and colorTheme (theme name)

Examples

  • Use a dark theme for TypeScript development
  • Switch to a light theme for Markdown files
  • Use a specialized theme for specific languages like Python, Rust, etc.

Requirements

No special requirements or dependencies.

Extension Settings

This extension contributes the following settings:

  • code-language-theme-selector.defaultTheme: Default theme to use for any language without a specific mapping
  • code-language-theme-selector.languageMappings: Language to theme mappings

Known Issues

None currently.

Release Notes

0.0.1

Initial release of Code Language Theme Selector.

1.0.0

Initial release of ...

1.0.1

Fixed issue #.

1.1.0

Added features X, Y, and Z.


Following extension guidelines

Ensure that you've read through the extensions guidelines and follow the best practices for creating your extension.

Working with Markdown

You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:

  • Split the editor (Cmd+\ on macOS or Ctrl+\ on Windows and Linux).
  • Toggle preview (Shift+Cmd+V on macOS or Shift+Ctrl+V on Windows and Linux).
  • Press Ctrl+Space (Windows, Linux, macOS) to see a list of Markdown snippets.

For more information

Enjoy!

About

VSCode/Cursor Extension to set editor theme based on the language of the active window

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published