Reputation: 1
How can I see with a code what themes are installed on a vscode? I'm making an extension and I need to know that
Upvotes: 0
Views: 1535
Reputation: 23
I found that it was the easiest to just map through all of the VSCode extensions and filter through them all for which ones were themes. From there you can go into extensionPath
property and look for the theme folder which should contain the JSON of the theme.
// returns all the extensions that VSCode knows of
let extensions = vscode.extensions.all;
// filter through the extensions for extensions with the category of "themes"
let extensionsPaths = extensions.filter(e => {
if (e.packageJSON.categories && e.packageJSON.categories.indexOf("Themes") != -1) {
return true;
}
// returns the directory of each of the extensions
}).map(e => e.extensionPath)
console.log(extensionsPaths)
Hopefully this is what you were looking for.
Upvotes: 1