Skip to content

Commit 4961353

Browse files
committed
feat: update theme color
1 parent 610ed94 commit 4961353

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

src/stores/modules/app.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { defineStore } from 'pinia'
2-
import { StyleProvider, Themes } from '@varlet/ui'
2+
import { darkTheme } from '@/styles/dark'
3+
import { lightTheme } from '@/styles/light'
34

45
export interface AppStore {
56
swithMode: (val: string) => void
@@ -17,9 +18,7 @@ const useAppStore = defineStore('app', () => {
1718
const mode = ref(theme)
1819

1920
const swithMode = (val: string) => {
20-
const rootStyleVars = val === 'light'
21-
? Themes.toViewport({ '--color-body': '#f7f8fa', '--result-title-font-size': '32px', '--result-description-font-size': '14px' })
22-
: Themes.toViewport({ ...Themes.dark, '--result-title-font-size': '32px', '--result-description-font-size': '14px' })
21+
const rootStyleVars = val === 'light' ? lightTheme : darkTheme
2322
StyleProvider(rootStyleVars)
2423

2524
mode.value = val

src/styles/app.less

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ body {
3232
// NProgress Style
3333
#nprogress {
3434
.bar {
35-
background: #81d8d0 !important;
35+
background: var(--color-nprogress) !important;
3636
}
3737

3838
.spinner-icon {
39-
border-top-color: #81d8d0;
40-
border-left-color: #81d8d0;
39+
border-top-color: var(--color-nprogress);
40+
border-left-color: var(--color-nprogress);
4141
}
4242
}
4343

src/styles/dark.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Themes } from '@varlet/ui'
2+
3+
export const darkTheme = Themes.toViewport({
4+
...Themes.dark,
5+
'--color-primary': '#00C16A',
6+
'--color-nprogress': '#D9FBE8',
7+
})

src/styles/light.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Themes } from '@varlet/ui'
2+
3+
export const lightTheme = Themes.toViewport({
4+
'--color-primary': '#00C16A',
5+
'--color-nprogress': '#75EDAE',
6+
'--color-body': '#f7f8fa',
7+
})

0 commit comments

Comments
 (0)