fluidd

Форк
0
/
convertTheme.cjs 
61 строка · 2.0 Кб
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
 */
24
const converter = require('monaco-vscode-textmate-theme-converter')
25
const fs = require('fs')
26

27
// Load the themes.
28
const dark = fs.readFileSync('../src/monaco/theme/base.theme.dark.json', 'utf8')
29
const baseDarkTheme = JSON.parse(dark)
30

31
const light = fs.readFileSync('../src/monaco/theme/base.theme.light.json', 'utf8')
32
const baseLightTheme = JSON.parse(light)
33

34
// Convert it.
35
const themeDark = converter.convertTheme(baseDarkTheme)
36
const themeLight = converter.convertTheme(baseLightTheme)
37

38
// Our themes should have some base colors applied to match Fluidd.
39
themeDark.inherit = true
40
themeDark.colors['editor.background'] = '#28282b'
41
themeDark.colors['editor.lineHighlightBackground'] = '#3a3a3e'
42
themeDark.colors['minimap.background'] = themeDark.colors['editor.background']
43
themeDark.rules.forEach(rule => {
44
  if (rule.foreground === '#5C6773') rule.foreground = '#7C8A99'
45
})
46

47
themeLight.inherit = false
48
themeLight.colors['minimap.background'] = themeLight.colors['editor.background']
49

50
// ..and write it to the file system.
51
fs.writeFile('../src/monaco/theme/editor.dark.theme.json', JSON.stringify(themeDark), (err) => {
52
  if (err) {
53
    throw err
54
  }
55
})
56

57
fs.writeFile('../src/monaco/theme/editor.light.theme.json', JSON.stringify(themeLight), (err) => {
58
  if (err) {
59
    throw err
60
  }
61
})
62

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.