All files / src/theme index.js

20% Statements 1/5
0% Branches 0/2
0% Functions 0/3
25% Lines 1/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16    1x                          
// 主题应用纯函数 —— 操作 <html> 上的 class 与 CSS 变量
 
const root = () => document.documentElement
 
// 写入主色变量
export function applyPrimaryColor(color) {
  if (color) {
    root().style.setProperty('--fms-primary', color)
  }
}
 
// 切换深浅色 class
export function applyDarkMode(isDark) {
  root().classList.toggle('dark', !!isDark)
}