Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DarkStoorM/55748c54d149d269606b414cba51eded to your computer and use it in GitHub Desktop.
Save DarkStoorM/55748c54d149d269606b414cba51eded to your computer and use it in GitHub Desktop.

Convert VSCode theme to Visual Studio 2022

You have probably stumbled upon this video, which explains how to convert your favorite VSCode theme to also be usable in Visual Studio 2022. Well, it's not entirely correct, it still applies, but there has to be some clarification.

As the video lacks some information, I will try to make it as easy as possible.

Table of Contents:

Prerequisities

  • Toolset: Visual Studio extension development
  • VSCode Theme Converter

VS Extension Development

First, if you can not create an Empty VSIX Project, you most likely have to modify your VS through Visual Studio Installer.

img

Click modify on your VS installation -> Workloads -> Other Toolsets

alt

The Empty VSIX Project should now be available.

VSCode Theme Converter

The video doesn't tell you to install this extension, so install it from here. This is the missing step that makes the Convert to Visual Studio Theme option appear.


Converting the Theme

TL;DR:

  • set color theme
  • open cmd Palette and search for Generate Color Theme
  • save as <name>.jsonc

First step is to open your VSCode and make sure your theme is currently active: ctrl + shift + x find and set the color theme. I'm using eppz.eppz-code for C# with Unity.

alt

Open the Command palette (ctrl + shift + p) and search for Generate Color Theme. This command will generate a json file with the current theme definition, which you can later import into new VSIX project.

Save this file as <name>.jsonc.

Importing VSCode theme file into VSIX Project

Open Visual Studio 2022, create a new project (Empty VSIX Project) and give it a name and hit create

alt

Location is the path for your built project!

Once your new project is ready, hit shift + alt + A to Add Existing Item. Locate your jsonc and add it into your project.

Remember to change the file filter to All Files (*.*) when locating your theme file, the dialog won't show it by default

The file is now in the project, but I believe the theme conversion step can be skipped, as apparently, Visual Studio seems to be doing that by default with jsonc files. The manual conversion can be done by right clicking the jsonc file in the Solution Explorer and selecting Convert to Visual Studio Theme:

alt

This option will only be available after installing the VSCode Theme Converter extension in Visual Studio

This creates a package definition, but it should be created by default, at least in VS Community 2022.

Building the Theme

The last step is to add this pkgdef to the extension assets. Double click the manifest file in the solution explorer, it should be named source.extension.vsixmanifest, then navigate to the Assets tab:

alt

Click new button, in the new window select the following:

  • Type: VsPackage
  • Source: File on filesystem
  • Path: select your pkgdef - it's a dropdown list, which will show the previously added asset

alt

Hit ok, then build your project with F6.

Once the Build is finished, the extension is ready to be installed as a theme. Navigate to your project, then to the output bin/debug/.

If you haven't changed the default location, it should be under %HOMEPATH%\source\repos\ then under <project_name>\<solution_name>\bin\debug\

alt

You can now double click the vsix file and let VS install the extension.

After restarting your VS, navigate to Tools -> Theme, select your exported theme, enjoy.

alt

alt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment