Skip to content

Commit

Permalink
refactor(projects): change css vars mount to root
Browse files Browse the repository at this point in the history
  • Loading branch information
mufeng889 committed Sep 3, 2024
1 parent b407ec4 commit c59edf6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/store/slice/theme/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ function getCssVarByTokens(tokens: App.Theme.BaseToken) {
}

/**
* Add theme vars to html
* Add theme vars to global
*
* @param tokens
*/
export function addThemeVarsToHtml(tokens: App.Theme.BaseToken, darkTokens: App.Theme.BaseToken) {
export function addThemeVarsToGlobal(tokens: App.Theme.BaseToken, darkTokens: App.Theme.BaseToken) {
const cssVarStr = getCssVarByTokens(tokens);
const darkCssVarStr = getCssVarByTokens(darkTokens);

const css = `
html {
:root {
${cssVarStr}
}
`;
Expand Down Expand Up @@ -237,7 +237,7 @@ export function toggleAuxiliaryColorModes(colourWeakness = false) {
/** Setup theme vars to html */
export function setupThemeVarsToHtml(themeColors: App.Theme.ThemeColor) {
const { themeTokens, darkThemeTokens } = createThemeToken(themeColors);
addThemeVarsToHtml(themeTokens, darkThemeTokens);
addThemeVarsToGlobal(themeTokens, darkThemeTokens);
}

export function updateDarkMode(themeScheme: UnionKey.ThemeScheme) {
Expand Down

0 comments on commit c59edf6

Please sign in to comment.