Commit acddd962 authored by yann300's avatar yann300

fix editor theming

parent 9bda06b1
...@@ -218,21 +218,22 @@ export const EditorUI = (props: EditorUIProps) => { ...@@ -218,21 +218,22 @@ export const EditorUI = (props: EditorUIProps) => {
function handleEditorWillMount (monaco) { function handleEditorWillMount (monaco) {
monacoRef.current = monaco monacoRef.current = monaco
// see https://microsoft.github.io/monaco-editor/playground.html#customizing-the-appearence-exposed-colors // see https://microsoft.github.io/monaco-editor/playground.html#customizing-the-appearence-exposed-colors
const backgroundColor = window.getComputedStyle(document.documentElement).getPropertyValue('--light').trim() const lightColor = window.getComputedStyle(document.documentElement).getPropertyValue('--light').trim()
const infoColor = window.getComputedStyle(document.documentElement).getPropertyValue('--info').trim() const infoColor = window.getComputedStyle(document.documentElement).getPropertyValue('--info').trim()
const darkColor = window.getComputedStyle(document.documentElement).getPropertyValue('--dark').trim() const darkColor = window.getComputedStyle(document.documentElement).getPropertyValue('--dark').trim()
const grayColor = window.getComputedStyle(document.documentElement).getPropertyValue('--gray-dark').trim() const grayColor = window.getComputedStyle(document.documentElement).getPropertyValue('--gray-dark').trim()
monaco.editor.defineTheme('remix-dark', { monaco.editor.defineTheme('remix-dark', {
base: 'vs-dark', base: 'vs-dark',
inherit: true, // can also be false to completely replace the builtin rules inherit: true, // can also be false to completely replace the builtin rules
rules: [{ background: backgroundColor.replace('#', '') }], rules: [{ background: darkColor.replace('#', '') }],
colors: { colors: {
'editor.background': backgroundColor, 'editor.background': darkColor,
'editorSuggestWidget.background': backgroundColor, 'editorSuggestWidget.background': lightColor,
'editorSuggestWidget.selectedBackground': backgroundColor, 'editorSuggestWidget.selectedBackground': lightColor,
'editorSuggestWidget.highlightForeground': infoColor, 'editorSuggestWidget.highlightForeground': infoColor,
'editor.lineHighlightBorder': darkColor, 'editor.lineHighlightBorder': lightColor,
'editor.lineHighlightBackground': grayColor 'editor.lineHighlightBackground': grayColor,
'editorGutter.background': lightColor
} }
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment