Skip to content

Commit 9e5e463

Browse files
authored
fix: the dark theme does not work (#714)
Co-authored-by: rick <LinuxSuRen@users.noreply.github.com>
1 parent e0ad523 commit 9e5e463

File tree

6 files changed

+91
-138
lines changed

6 files changed

+91
-138
lines changed

console/atest-ui/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html lang="en">
2+
<html lang="en" class="">
33
<head>
44
<meta charset="UTF-8">
55
<link rel="icon" href="/favicon.ico">

console/atest-ui/package-lock.json

Lines changed: 83 additions & 109 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

console/atest-ui/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
"@vueuse/core": "^10.11.0",
2020
"codemirror": "^5.65.17",
2121
"diff-match-patch": "^1.0.5",
22-
"element-plus": "^2.9.6",
22+
"element-plus": "^2.10.2",
2323
"intro.js": "^7.0.1",
2424
"jsonlint-mod": "^1.7.6",
25-
"jsonpath-plus": "^10.0.7",
25+
"jsonpath-plus": "^10.3.0",
2626
"skywalking-client-js": "^0.10.0",
2727
"vue": "^3.3.4",
2828
"vue-codemirror": "^5.1.0",
29-
"vue-i18n": "^9.2.2",
29+
"vue-i18n": "^11.1.2",
3030
"vue-json-viewer": "^3.0.4",
3131
"vue-router": "^4.2.2"
3232
},

console/atest-ui/src/App.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ const toHistoryPanel = ({ ID: selectID, panelName: historyPanelName }) => {
147147
</el-dropdown-menu>
148148
</template>
149149
</el-dropdown>
150+
151+
<el-switch type="primary" data-intro="Switch light and dark modes" v-model="asDarkMode"/>
150152
</el-col>
151153
</div>
152154
<TestingPanel v-if="panelName === 'testing'" @toHistoryPanel="toHistoryPanel"/>

console/atest-ui/src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import en from './locales/en.json'
1313
import zh from './locales/zh.json'
1414
import ClientMonitor from 'skywalking-client-js'
1515
import { name, version } from '../package'
16+
import 'element-plus/theme-chalk/dark/css-vars.css'
1617

1718
const app = createApp(App)
1819

console/atest-ui/src/theme.ts

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,3 @@
1-
const lightTheme: { [k: string]: string } = {
2-
'--color-background': 'var(--vt-c-white)',
3-
'--color-background-soft': 'var(--vt-c-white-soft)',
4-
'--color-background-mute': 'var(--vt-c-white-mute)',
5-
'--color-border': 'var(--vt-c-divider-light-2)',
6-
'--color-border-hover': 'var(--vt-c-divider-light-1)',
7-
'--color-heading': 'var(--vt-c-text-light-1)',
8-
'--color-text': 'var(--vt-c-text-light-1)'
9-
}
10-
11-
const darkTheme: { [k: string]: string } = {
12-
'--color-background': 'var(--vt-c-black)',
13-
'--color-background-soft': 'var(--vt-c-black-soft)',
14-
'--color-background-mute': 'var(--vt-c-black-mute)',
15-
'--color-border': 'var(--vt-c-divider-dark-2)',
16-
'--color-border-hover': 'var(--vt-c-divider-dark-1)',
17-
'--color-heading': 'var(--vt-c-text-dark-1)',
18-
'--color-text': 'var(--vt-c-text-dark-2)'
19-
}
20-
21-
221
export default function setAsDarkTheme(darkMode: boolean) {
23-
const theme = darkMode ? darkTheme : lightTheme
24-
Object.keys(theme).forEach((key) => {
25-
document.documentElement.style.setProperty(key, theme[key])
26-
})
2+
document.documentElement.className = darkMode ? 'dark' : 'light'
273
}

0 commit comments

Comments
 (0)