1. 定义css变量
// 默认模式
:root {
color-scheme: light dark;
// 背景色
--theme_background: #F2F3F6;
}
2. js切换
document.documentElement.style.setProperty('--theme_background','#000');
1. 定义css变量
// 默认模式
:root {
color-scheme: light dark;
// 背景色
--theme_background: #F2F3F6;
}
2. js切换
document.documentElement.style.setProperty('--theme_background','#000');