From 49c072b40d2bc2692370c91dab810be9f87ac95f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=98=AD?= <81747598+lan-yonghui@users.noreply.github.com> Date: Mon, 11 Nov 2024 22:46:27 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E8=89=B2=E5=8F=8A=E6=A0=B7=E5=BC=8F=20(#7002)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/log-file/index.vue | 2 +- frontend/src/components/terminal/index.vue | 6 +- frontend/src/styles/element-dark.scss | 78 ++++++++++++++++++- frontend/src/styles/element.scss | 6 ++ frontend/src/utils/xpack.ts | 1 + frontend/src/views/app-store/apps/index.vue | 2 +- frontend/src/views/database/mysql/index.vue | 5 +- .../src/views/database/postgresql/index.vue | 5 +- frontend/src/views/database/redis/index.vue | 5 +- frontend/src/views/home/index.vue | 2 +- .../src/views/host/terminal/command/index.vue | 2 +- .../views/host/terminal/terminal/index.vue | 11 +-- frontend/src/views/log/operation/index.vue | 8 ++ .../src/views/login/components/login-form.vue | 3 +- frontend/src/views/setting/panel/index.vue | 1 + .../views/setting/panel/theme-color/index.vue | 14 ++-- .../website/runtime/php/create/index.vue | 13 +--- 17 files changed, 126 insertions(+), 38 deletions(-) diff --git a/frontend/src/components/log-file/index.vue b/frontend/src/components/log-file/index.vue index f5447ec2870a..7642d4c92fbb 100644 --- a/frontend/src/components/log-file/index.vue +++ b/frontend/src/components/log-file/index.vue @@ -290,7 +290,7 @@ defineExpose({ changeTail, onDownload, clearLog }); overflow-y: auto; overflow-x: auto; position: relative; - background-color: #1e1e1e; + background-color: var(--panel-logs-bg-color); margin-top: 10px; } diff --git a/frontend/src/components/terminal/index.vue b/frontend/src/components/terminal/index.vue index 653ef9f3a9b8..2ac20c920683 100644 --- a/frontend/src/components/terminal/index.vue +++ b/frontend/src/components/terminal/index.vue @@ -47,12 +47,13 @@ const acceptParams = (props: WsProps) => { }; const newTerm = () => { + const background = getComputedStyle(document.documentElement).getPropertyValue('--panel-terminal-bg-color').trim(); term.value = new Terminal({ lineHeight: 1.2, fontSize: 12, fontFamily: "Monaco, Menlo, Consolas, 'Courier New', monospace", theme: { - background: '#000000', + background: background, }, cursorBlink: true, cursorStyle: 'underline', @@ -243,4 +244,7 @@ onBeforeUnmount(() => { width: 100%; height: 100%; } +:deep(.xterm) { + padding: 5px !important; +} diff --git a/frontend/src/styles/element-dark.scss b/frontend/src/styles/element-dark.scss index 564eb19b951a..eb59bfdb2658 100644 --- a/frontend/src/styles/element-dark.scss +++ b/frontend/src/styles/element-dark.scss @@ -49,6 +49,12 @@ html.dark { --el-color-primary-light-7: var(--panel-color-primary-light-7); --el-color-primary-light-8: var(--panel-color-primary-light-8); --el-color-primary-light-9: var(--panel-color-primary-light-9); + --el-color-primary-dark-2: var(--panel-color-primary); + --el-scrollbar-bg-color: var(--panel-main-bg-color-8); + --el-border-color-darker: var(--panel-main-bg-color-6); + --el-color-success:#238636; + --el-color-success-light-8: #3fb950; + --el-color-success-light-9: #3fb95030; --panel-border: 2px solid var(--panel-main-bg-color-8); @@ -59,7 +65,10 @@ html.dark { --panel-footer-border: var(--panel-main-bg-color-7); --panel-text-color: var(--panel-main-bg-color-1); --panel-menu-bg-color: var(--panel-main-bg-color-10); - --panel-terminal-tag-bg-color: var(--panel-main-bg-color-10); + --panel-terminal-tag-bg-color: var(--panel-main-bg-color-10); + --panel-terminal-tag-active-bg-color: var(--panel-main-bg-color-10); + --panel-terminal-bg-color: var(--panel-main-bg-color-10); + --panel-logs-bg-color: var(--panel-main-bg-color-9); --el-menu-item-bg-color: var(--panel-main-bg-color-10); --el-menu-item-bg-color-active: var(--panel-main-bg-color-8); @@ -160,14 +169,14 @@ html.dark { --el-button-hover-border-color: var(--panel-main-bg-color-8); } - .el-button:hover { + .el-button--primary:hover { --el-button-hover-text-color: var(--panel-text-color-white); --el-button-border-color: var(--el-color-primary-light-3); --el-button-hover-bg-color: var(--el-color-primary-light-3); --el-button-hover-border-color: var(--el-color-primary-light-3); } - .el-button:active { + .el-button--primary:active { --el-button-hover-text-color: var(--panel-text-color-white); --el-button-active-bg-color: var(--el-color-primary-light-3); --el-button-active-border-color: var(--el-color-primary-light-3); @@ -197,7 +206,7 @@ html.dark { } .el-drawer .el-drawer__header span { - color: var(--el-menu-text-color); + color: var(--panel-text-color); } .el-dialog { @@ -234,4 +243,65 @@ html.dark { --el-color-info: var(--panel-alert-info-text-color); } + .md-editor-dark { + --md-bk-color: var(--panel-main-bg-color-8); + } + .md-editor-dark .md-editor-preview { + --md-theme-color: var(--el-text-color-primary); + } + .md-editor-dark .default-theme a { + --md-theme-link-color: var(--el-color-primary); + } + + .el-descriptions__title { + color: var(--el-text-color-primary); + } + .el-descriptions__content.el-descriptions__cell.is-bordered-content { + color: var(--el-text-color-primary); + } + .el-descriptions--large .el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell { + padding: 12px 15px; + background-color: transparent; + } + .el-descriptions__body { + background-color: transparent; + } + .el-descriptions__label { + color: var(--el-color-primary) !important; + margin-right: 16px; + } + + .el-avatar { + --el-avatar-bg-color: var(--panel-main-bg-color-7) !important; + box-shadow: 0 0 4px rgba(0, 94, 235, 0.1); + border: 0.5px solid var(--panel-main-bg-color-7); + } + + .cm-editor { + background-color: var(--panel-main-bg-color-9); + } + .cm-gutters { + background-color: var(--panel-main-bg-color-8); + } + + // scroll-bar + ::-webkit-scrollbar { + background-color: var(--el-scrollbar-bg-color) !important; + } + ::-webkit-scrollbar-thumb { + background-color: var(--el-border-color-darker); + } + + .app-warn { + span { + &:nth-child(2) { + color: var(--panel-color-primary); + + &:hover { + color: var(--panel-color-primary-light-3); + } + } + } + } + } \ No newline at end of file diff --git a/frontend/src/styles/element.scss b/frontend/src/styles/element.scss index 83f8fb4098a2..36998aa79cfb 100644 --- a/frontend/src/styles/element.scss +++ b/frontend/src/styles/element.scss @@ -25,6 +25,9 @@ --el-color-primary-light-9: var(--panel-color-primary-light-9); --el-text-color-regular: #646a73; + --el-color-success:#238636; + --el-color-success-light-8: #3fb950; + --el-color-success-light-9: #3fb95030; } html { @@ -44,6 +47,9 @@ html { --panel-button-bg-color: #ffffff; --panel-footer-border: #e4e7ed; --panel-terminal-tag-bg-color: #efefef; + --panel-terminal-tag-active-bg-color: #575758; + --panel-terminal-bg-color: #1e1e1e; + --panel-logs-bg-color: #1e1e1e; --panel-alert-bg: #e2e4ec; --panel-path-bg: #ffffff; diff --git a/frontend/src/utils/xpack.ts b/frontend/src/utils/xpack.ts index 1fe395c490d8..aef395f1d443 100644 --- a/frontend/src/utils/xpack.ts +++ b/frontend/src/utils/xpack.ts @@ -115,6 +115,7 @@ export async function getXpackSettingForTheme() { globalStore.themeConfig.logoWithText = res2.data?.logoWithText; globalStore.themeConfig.favicon = res2.data?.favicon; globalStore.themeConfig.themeColor = res2.data?.themeColor; + globalStore.themeConfig.theme = res2.data?.theme || 'auto'; } else { resetXSetting(); } diff --git a/frontend/src/views/app-store/apps/index.vue b/frontend/src/views/app-store/apps/index.vue index c1bc85cb0438..4419cd79df0b 100644 --- a/frontend/src/views/app-store/apps/index.vue +++ b/frontend/src/views/app-store/apps/index.vue @@ -282,7 +282,7 @@ onMounted(() => { }); - diff --git a/frontend/src/views/login/components/login-form.vue b/frontend/src/views/login/components/login-form.vue index 8acb11502814..5fb410fd1443 100644 --- a/frontend/src/views/login/components/login-form.vue +++ b/frontend/src/views/login/components/login-form.vue @@ -366,7 +366,8 @@ const loadDataFromDB = async () => { globalStore.setDefaultNetwork(res.data.defaultNetwork); globalStore.setOpenMenuTabs(res.data.menuTabs === 'enable'); globalStore.updateLanguage(res.data.language); - globalStore.setThemeConfig({ ...themeConfig.value, theme: res.data.theme, panelName: res.data.panelName }); + let theme = globalStore.themeConfig.theme === res.data.theme ? res.data.theme : globalStore.themeConfig.theme; + globalStore.setThemeConfig({ ...themeConfig.value, theme: theme, panelName: res.data.panelName }); }; onMounted(() => { diff --git a/frontend/src/views/setting/panel/index.vue b/frontend/src/views/setting/panel/index.vue index 748c2a38ee38..da4ea2abfee5 100644 --- a/frontend/src/views/setting/panel/index.vue +++ b/frontend/src/views/setting/panel/index.vue @@ -303,6 +303,7 @@ const search = async () => { form.theme = xpackRes.data.theme || globalStore.themeConfig.theme; form.themeColor = JSON.parse(xpackRes.data.themeColor); globalStore.themeConfig.themeColor = xpackRes.data.themeColor; + globalStore.themeConfig.theme = form.theme; form.proxyDocker = xpackRes.data.proxyDocker; } } else { diff --git a/frontend/src/views/setting/panel/theme-color/index.vue b/frontend/src/views/setting/panel/theme-color/index.vue index a6b735ce7ed9..1c9c0b773c2b 100644 --- a/frontend/src/views/setting/panel/theme-color/index.vue +++ b/frontend/src/views/setting/panel/theme-color/index.vue @@ -27,11 +27,11 @@ - - - + {{ $t('runtime.extendHelper') }} - + {{ $t('runtime.rebuild') }} - - - - {{ $t('runtime.rebuildHelper') }} - - + {{ $t('runtime.rebuildHelper') }}