opt: 优化编辑器、charts等页面主题样式

This commit is contained in:
gary
2026-02-01 16:43:14 +08:00
parent 350b6dadef
commit fb95c8e934
4 changed files with 42 additions and 1 deletions

View File

@@ -568,3 +568,35 @@ body,
.dark::view-transition-new(root) { .dark::view-transition-new(root) {
z-index: 1; z-index: 1;
} }
/* 整体编辑器区域 */
.monaco-editor.vs {
background-color: #f5f7fa;
}
/* gutter行号区 */
.monaco-editor.vs .margin {
background-color: #f0f2f5;
box-shadow: inset -1px 0 0 #dcdfe6;
}
/* 内容区 */
.monaco-editor.vs .monaco-editor-background {
background-color: #ffffff;
}
/* Dark Mode Editor Contrast */
.dark .monaco-editor.vs-dark {
background-color: var(--el-bg-color);
border: none;
}
.dark .monaco-editor.vs-dark .margin {
background-color: #252526 !important;
box-shadow: inset -1px 0 0 #424242;
border: none;
}
.dark .monaco-editor.vs-dark .monaco-editor-background {
background-color: #1e1e1e !important;
}

View File

@@ -17,7 +17,6 @@ const defaultConfig = {
automaticLayout: true, automaticLayout: true,
autoIndent: 'full', autoIndent: 'full',
scrollBeyondLastLine: false, scrollBeyondLastLine: false,
theme: 'vs-dark',
wordWrap: 'on', wordWrap: 'on',
readOnly: true readOnly: true
} }

View File

@@ -45,6 +45,7 @@ const chartConfig = {
<v-chart <v-chart
v-if="chartConfig" v-if="chartConfig"
class="chart" class="chart"
:key="theme"
:theme="theme" :theme="theme"
:option="chartConfig" :option="chartConfig"
autoresize autoresize

View File

@@ -1,9 +1,17 @@
<script setup> <script setup>
import { useMonacoEditorOptions } from '@/vendors/monaco-editor' import { useMonacoEditorOptions } from '@/vendors/monaco-editor'
import { $copyText } from '@/utils' import { $copyText } from '@/utils'
import { useGlobalConfigStore } from '@/stores/GlobalConfigStore'
import { computed } from 'vue'
const globalConfigStore = useGlobalConfigStore()
const { contentRef, languageRef, editorRef, monacoEditorOptions, formatDocument } = useMonacoEditorOptions({ const { contentRef, languageRef, editorRef, monacoEditorOptions, formatDocument } = useMonacoEditorOptions({
readOnly: false readOnly: false
}) })
const theme = computed(() => {
return globalConfigStore.isDarkTheme ? 'vs-dark' : 'vs'
})
</script> </script>
<template> <template>
@@ -13,6 +21,7 @@ const { contentRef, languageRef, editorRef, monacoEditorOptions, formatDocument
:language="languageRef" :language="languageRef"
height="400px" height="400px"
:options="monacoEditorOptions" :options="monacoEditorOptions"
:theme="theme"
@mount="editorRef=$event" @mount="editorRef=$event"
/> />
<el-footer <el-footer