fluidd
1/**
2* This automates theme conversion from VSCode -> a textmate theme which is
3* usable by Fluidd's monaco implementation.
4*
5* The base dark theme is Ayu Mirage
6* The base light theme is VSCode's Light+
7*
8* Both the klipper-config and gcode extensions must be installed before
9* generating the base themes, otherwise the correct token colors won't be
10* generated.
11*
12* You can create the base theme by using VSCodes command pallette and using
13* the following command;
14* Developer: Generate Color Theme From Current Settings
15*
16* This is all otherwise pretty horrid, and we should think about automating
17* this further in the future.
18*
19* You can invoke this script using npm;
20* npm run theme.convert
21*
22* which will write the appropriate theme files in their intended location.
23*/
24const converter = require('monaco-vscode-textmate-theme-converter')25const fs = require('fs')26
27// Load the themes.
28const dark = fs.readFileSync('../src/monaco/theme/base.theme.dark.json', 'utf8')29const baseDarkTheme = JSON.parse(dark)30
31const light = fs.readFileSync('../src/monaco/theme/base.theme.light.json', 'utf8')32const baseLightTheme = JSON.parse(light)33
34// Convert it.
35const themeDark = converter.convertTheme(baseDarkTheme)36const themeLight = converter.convertTheme(baseLightTheme)37
38// Our themes should have some base colors applied to match Fluidd.
39themeDark.inherit = true40themeDark.colors['editor.background'] = '#28282b'41themeDark.colors['editor.lineHighlightBackground'] = '#3a3a3e'42themeDark.colors['minimap.background'] = themeDark.colors['editor.background']43themeDark.rules.forEach(rule => {44if (rule.foreground === '#5C6773') rule.foreground = '#7C8A99'45})46
47themeLight.inherit = false48themeLight.colors['minimap.background'] = themeLight.colors['editor.background']49
50// ..and write it to the file system.
51fs.writeFile('../src/monaco/theme/editor.dark.theme.json', JSON.stringify(themeDark), (err) => {52if (err) {53throw err54}55})56
57fs.writeFile('../src/monaco/theme/editor.light.theme.json', JSON.stringify(themeLight), (err) => {58if (err) {59throw err60}61})62