Skip to content

Vaultspeed/monaco-vscode-textmate-theme-converter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

monaco-vscode-textmate-theme-converter

VSCode themes are directly not compatible with monaco-editor themes. The problem here is that vscode uses tmGrammar tokens for colorization support while monaco uses its own code editor to generate language tokens. (See more about it here).

Yu can use monaco-textmate to make your monac-editor tmGrammar compatible.

Once the tokens are tmGrammar compatible, you need to convert vscode generated theme data to monaco-editor compatible api. This package does exactly that.

Usage:

import { convertTheme, convertThemeFromDir } from 'monaco-vscode-textmate-theme-converter'; // UMD module
// import { convertTheme, convertThemeFromDir } from 'monaco-vscode-textmate-theme-converter/lib/cjs'; // cjs module

/*
 * In vscode use command: `Developer: Generate Color Theme From Current Settings`
 * Copy the generated JSON and use it as input for the function below.
 */
const theme : IVSCodeTheme = {...}
convertTheme(theme);

/*
 * Convert multiple vscode themes to monaco themes.
 * This function takes as arguments an input directory with generated vscode json files and generated output files with the same names at output directory.
 */
convertThemeFromDir(inputDir: './my-vscode-themes-collection-dir/in', outDir: './my-vscode-themes-collection-dir/out');

About

monaco-vscode-textmate-theme-converter

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%