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