perf(projects): perf code
This commit is contained in:
parent
96e4aff5c8
commit
8081e19ebc
@ -25,7 +25,6 @@ export const useThemeStore = defineStore(SetupStoreId.Theme, () => {
|
||||
if (settings.value.themeScheme === 'auto') {
|
||||
return osTheme.value === 'dark';
|
||||
}
|
||||
|
||||
return settings.value.themeScheme === 'dark';
|
||||
});
|
||||
|
||||
|
@ -9,7 +9,6 @@ const DARK_CLASS = 'dark';
|
||||
|
||||
/**
|
||||
* init theme settings
|
||||
* @param darkMode is dark mode
|
||||
*/
|
||||
export function initThemeSettings() {
|
||||
const isProd = import.meta.env.PROD;
|
||||
@ -34,7 +33,7 @@ export function initThemeSettings() {
|
||||
|
||||
/**
|
||||
* create theme token
|
||||
* @param darkMode is dark mode
|
||||
* @param colors theme colors
|
||||
*/
|
||||
export function createThemeToken(colors: App.Theme.ThemeColor) {
|
||||
const paletteColors = createThemePaletteColors(colors);
|
||||
@ -146,7 +145,8 @@ export function addThemeVarsToHtml(tokens: App.Theme.BaseToken, darkTokens: App.
|
||||
const darkCss = `
|
||||
html.${DARK_CLASS} {
|
||||
${darkCssVarStr}
|
||||
`;
|
||||
}
|
||||
`;
|
||||
|
||||
const style = document.createElement('style');
|
||||
|
||||
@ -157,7 +157,7 @@ export function addThemeVarsToHtml(tokens: App.Theme.BaseToken, darkTokens: App.
|
||||
|
||||
/**
|
||||
* toggle css dark mode
|
||||
* @param darkMode
|
||||
* @param darkMode is dark mode
|
||||
*/
|
||||
export function toggleCssDarkMode(darkMode = false) {
|
||||
function addDarkClass() {
|
||||
@ -185,7 +185,7 @@ interface NaiveColorAction {
|
||||
|
||||
/**
|
||||
* get naive theme colors
|
||||
* @param colors
|
||||
* @param colors theme colors
|
||||
*/
|
||||
function getNaiveThemeColors(colors: App.Theme.ThemeColor) {
|
||||
const colorActions: NaiveColorAction[] = [
|
||||
|
Loading…
Reference in New Issue
Block a user