All files / src/theme index.js

100% Statements 5/5
100% Branches 2/2
100% Functions 3/3
100% Lines 4/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    3x       2x 1x           2x    
// 主题应用纯函数 —— 操作 <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)
}