|
| 1 | +// DO NOT CHANGE ANYTHING HERE |
| 2 | +// This file is part of the Codebytes MVP and only includes basic configuration around theming for the SimpleMonacoEditor component |
| 3 | +// We are working on a monaco package in client-modules that has more configuration around themes and languages |
| 4 | +// Monaco as a shared package RFC https://www.notion.so/codecademy/Monaco-editor-as-a-shared-package-1f4484db165b4abc8394c3556451ef6a |
| 5 | + |
| 6 | +import type * as monaco from 'monaco-editor'; |
| 7 | + |
| 8 | +import * as darkColors from './colorsDark'; |
| 9 | + |
| 10 | +const c = (color: string) => color.substr(1); |
| 11 | + |
| 12 | +const theme = ({ |
| 13 | + ui, |
| 14 | + syntax, |
| 15 | +}: { |
| 16 | + ui: darkColors.UIColors; |
| 17 | + syntax: darkColors.SyntaxColors; |
| 18 | +}): monaco.editor.IStandaloneThemeData => ({ |
| 19 | + base: 'vs-dark', |
| 20 | + inherit: true, |
| 21 | + rules: [ |
| 22 | + // Base |
| 23 | + { token: '', foreground: c(syntax.basic) }, |
| 24 | + { token: 'regexp', foreground: c(syntax.regexp) }, |
| 25 | + { token: 'annotation', foreground: c(syntax.annotation) }, |
| 26 | + { token: 'type', foreground: c(syntax.annotation) }, |
| 27 | + { token: 'doctype', foreground: c(syntax.comment) }, |
| 28 | + { token: 'delimiter', foreground: c(syntax.decoration) }, |
| 29 | + { token: 'invalid', foreground: c(syntax.invalid) }, |
| 30 | + { token: 'emphasis', fontStyle: 'italic' }, |
| 31 | + { token: 'strong', fontStyle: 'bold' }, |
| 32 | + { token: 'variable', foreground: c(syntax.variable) }, |
| 33 | + { token: 'variable.predefined', foreground: c(syntax.variable) }, |
| 34 | + { token: 'constant', foreground: c(syntax.constant) }, |
| 35 | + { token: 'comment', foreground: c(syntax.comment) }, |
| 36 | + { token: 'number', foreground: c(syntax.number) }, |
| 37 | + { token: 'number.hex', foreground: c(syntax.number) }, |
| 38 | + { token: 'keyword.directive', foreground: c(syntax.comment) }, |
| 39 | + { token: 'include', foreground: c(syntax.comment) }, |
| 40 | + { token: 'key', foreground: c(syntax.property) }, |
| 41 | + { token: 'attribute.name', foreground: c(syntax.attribute) }, |
| 42 | + { token: 'attribute.name-numeric', foreground: c(syntax.string) }, |
| 43 | + { token: 'attribute.value', foreground: c(syntax.property) }, |
| 44 | + { token: 'attribute.value.number', foreground: c(syntax.number) }, |
| 45 | + { token: 'string', foreground: c(syntax.string) }, |
| 46 | + { token: 'string.yaml', foreground: c(syntax.string) }, |
| 47 | + { token: 'tag', foreground: c(syntax.tag) }, |
| 48 | + { token: 'tag.id.jade', foreground: c(syntax.tag) }, |
| 49 | + { token: 'tag.class.jade', foreground: c(syntax.tag) }, |
| 50 | + { token: 'metatag', foreground: c(syntax.comment) }, |
| 51 | + { token: 'attribute.value.unit', foreground: c(syntax.string) }, |
| 52 | + { token: 'keyword', foreground: c(syntax.keyword) }, |
| 53 | + { token: 'keyword.flow', foreground: c(syntax.keyword) }, |
| 54 | + ], |
| 55 | + colors: { |
| 56 | + 'editor.background': ui.background, |
| 57 | + 'editor.foreground': ui.text, |
| 58 | + 'editorIndentGuide.background': ui.indent.inactive, |
| 59 | + 'editorIndentGuide.activeBackground': ui.indent.active, |
| 60 | + 'editorWhitespace.foreground': syntax.comment, |
| 61 | + }, |
| 62 | +}); |
| 63 | + |
| 64 | +export const dark = theme(darkColors); |
0 commit comments