refactor: export theme overrides for discrete api

This commit is contained in:
tiny-craft 2023-08-20 15:45:20 +08:00
parent c3c61e78f3
commit 36c23deef8
4 changed files with 40 additions and 27 deletions

View File

@ -18,35 +18,11 @@ import { useI18n } from 'vue-i18n'
import { darkTheme, lightTheme, useOsTheme } from 'naive-ui'
import KeyFilterDialog from './components/dialogs/KeyFilterDialog.vue'
import { WindowSetDarkTheme, WindowSetLightTheme } from 'wailsjs/runtime/runtime.js'
import { themeOverrides } from '@/utils/theme.js'
hljs.registerLanguage('json', json)
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 connectionStore = useConnectionStore()
const i18n = useI18n()
@ -58,6 +34,9 @@ onBeforeMount(async () => {
i18n.locale.value = prefStore.currentLanguage
await prefStore.loadFontList()
await connectionStore.initConnections()
if (prefStore.autoCheckUpdate) {
prefStore.checkForUpdate()
}
} finally {
initializing.value = false
}

View File

@ -1,7 +1,12 @@
import { createDiscreteApi } from 'naive-ui'
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() {
return {

View File

@ -1,6 +1,11 @@
import { createDiscreteApi } from 'naive-ui'
import { themeOverrides } from '@/utils/theme.js'
const { message } = createDiscreteApi(['message'])
const { message } = createDiscreteApi(['message'], {
configProviderProps: {
themeOverrides,
},
})
export function useMessage() {
return {

View File

@ -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',
},
}