[go: up one dir, main page]

Skip to content

A VS code extension to change the color theme based on the current file language

License

Notifications You must be signed in to change notification settings

jsaulou/vscode-theme-by-language

Repository files navigation

Theme by language

Themes are great but sometimes some are better than others for a certain language.

This extension lets you select which theme to apply by language.

If you prefer, like me, to edit Markdown and AsciiDoc files using a dark theme but code using a light theme, or prefer the coloration of a theme for a specific language, this extension is made for you.

Preview

Preview

How to use

Important: If you have set a theme for a language, changing the color theme using the standard vscode menu will not work. To change the default theme, use the Set default theme command.

Set default theme fallback

Use the command Set default theme to set the default theme. This theme will be used for all file languages that do not have a custom theme set.

Set custom theme for a filetype

Open a file and use the command Set theme for current file language to set the theme to use for this file language.

To revert to the default theme for the current file language, use the command Use the default for current file language.

Clear all custom themes

To unregister all custom themes, use the command Clear all registered custom themes for file languages.

Set a theme based on filename

IMPORTANT: Entries starting with filename: take precedence over other entries.

NOTE There is no UI to do this. You will need to edit your settings.json manually.

To set a theme based on the filename, open your settings.json and add an entry to your theme-by-language.themes configuration entry. The key must be of the following format: filename:<filename regex>.

Example:

"theme-by-language.themes": {
  "*": "Minone",
  "markdown": "Visual Studio Dark",
  "python": "Default Dark+",
  "filename:.*\\.ipynb": "<theme name>",
  "filename:.*\\.drawio": "<theme name>",
}

Limitations

  • Changing the language manually for the current file will not automatically change the theme. You will need to switch editors.
  • Does not work well when switching between multiple instances of vscode.

Special thanks to @MrDoomy for creating the logo!

Enjoy!

About

A VS code extension to change the color theme based on the current file language

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published