refactor: export theme overrides for discrete api
This commit is contained in:
parent
c3c61e78f3
commit
36c23deef8
|
@ -18,35 +18,11 @@ import { useI18n } from 'vue-i18n'
|
||||||
import { darkTheme, lightTheme, useOsTheme } from 'naive-ui'
|
import { darkTheme, lightTheme, useOsTheme } from 'naive-ui'
|
||||||
import KeyFilterDialog from './components/dialogs/KeyFilterDialog.vue'
|
import KeyFilterDialog from './components/dialogs/KeyFilterDialog.vue'
|
||||||
import { WindowSetDarkTheme, WindowSetLightTheme } from 'wailsjs/runtime/runtime.js'
|
import { WindowSetDarkTheme, WindowSetLightTheme } from 'wailsjs/runtime/runtime.js'
|
||||||
|
import { themeOverrides } from '@/utils/theme.js'
|
||||||
|
|
||||||
hljs.registerLanguage('json', json)
|
hljs.registerLanguage('json', json)
|
||||||
hljs.registerLanguage('plaintext', plaintext)
|
hljs.registerLanguage('plaintext', plaintext)
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @type import('naive-ui').GlobalThemeOverrides
|
|
||||||
*/
|
|
||||||
const themeOverrides = {
|
|
||||||
common: {
|
|
||||||
primaryColor: '#D33A31',
|
|
||||||
primaryColorHover: '#FF6B6B',
|
|
||||||
primaryColorPressed: '#D5271C',
|
|
||||||
primaryColorSuppl: '#FF6B6B',
|
|
||||||
borderRadius: '4px',
|
|
||||||
borderRadiusSmall: '3px',
|
|
||||||
lineHeight: 1.5,
|
|
||||||
scrollbarWidth: '8px',
|
|
||||||
},
|
|
||||||
Tag: {
|
|
||||||
// borderRadius: '3px'
|
|
||||||
},
|
|
||||||
Tabs: {
|
|
||||||
tabGapSmallCard: '1px',
|
|
||||||
tabGapMediumCard: '1px',
|
|
||||||
tabGapLargeCard: '1px',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
const prefStore = usePreferencesStore()
|
const prefStore = usePreferencesStore()
|
||||||
const connectionStore = useConnectionStore()
|
const connectionStore = useConnectionStore()
|
||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
|
@ -58,6 +34,9 @@ onBeforeMount(async () => {
|
||||||
i18n.locale.value = prefStore.currentLanguage
|
i18n.locale.value = prefStore.currentLanguage
|
||||||
await prefStore.loadFontList()
|
await prefStore.loadFontList()
|
||||||
await connectionStore.initConnections()
|
await connectionStore.initConnections()
|
||||||
|
if (prefStore.autoCheckUpdate) {
|
||||||
|
prefStore.checkForUpdate()
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
initializing.value = false
|
initializing.value = false
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
import { createDiscreteApi } from 'naive-ui'
|
import { createDiscreteApi } from 'naive-ui'
|
||||||
import { i18nGlobal } from '@/utils/i18n.js'
|
import { i18nGlobal } from '@/utils/i18n.js'
|
||||||
|
import { themeOverrides } from '@/utils/theme.js'
|
||||||
|
|
||||||
const { dialog } = createDiscreteApi(['dialog'])
|
const { dialog } = createDiscreteApi(['dialog'], {
|
||||||
|
configProviderProps: {
|
||||||
|
themeOverrides,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
export function useConfirmDialog() {
|
export function useConfirmDialog() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
import { createDiscreteApi } from 'naive-ui'
|
import { createDiscreteApi } from 'naive-ui'
|
||||||
|
import { themeOverrides } from '@/utils/theme.js'
|
||||||
|
|
||||||
const { message } = createDiscreteApi(['message'])
|
const { message } = createDiscreteApi(['message'], {
|
||||||
|
configProviderProps: {
|
||||||
|
themeOverrides,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
export function useMessage() {
|
export function useMessage() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type import('naive-ui').GlobalThemeOverrides
|
||||||
|
*/
|
||||||
|
export const themeOverrides = {
|
||||||
|
common: {
|
||||||
|
primaryColor: '#D33A31',
|
||||||
|
primaryColorHover: '#FF6B6B',
|
||||||
|
primaryColorPressed: '#D5271C',
|
||||||
|
primaryColorSuppl: '#FF6B6B',
|
||||||
|
borderRadius: '4px',
|
||||||
|
borderRadiusSmall: '3px',
|
||||||
|
lineHeight: 1.5,
|
||||||
|
scrollbarWidth: '8px',
|
||||||
|
},
|
||||||
|
Tag: {
|
||||||
|
// borderRadius: '3px'
|
||||||
|
},
|
||||||
|
Tabs: {
|
||||||
|
tabGapSmallCard: '1px',
|
||||||
|
tabGapMediumCard: '1px',
|
||||||
|
tabGapLargeCard: '1px',
|
||||||
|
},
|
||||||
|
}
|
Loading…
Reference in New Issue