我想根据主题更改标签和网格线的颜色..这是我更改主题的代码
function mystylesheet () { console.log(currentTheme) if(checkBox.checked){
document.getElementById("mystylesheet").setAttribute('href', "css/theme/dark.css");
window.localStorage.setItem('data-theme', 'dark'); } else {
document.getElementById("mystylesheet").setAttribute('href', "css/theme/light.css")
window.localStorage.setItem('data-theme', 'light'); } changeImage(); }
这是在chatjs中更改Tick颜色或标签颜色
var lableColor = 'black'; //Lables color if(currentTheme === 'dark'){ lableColor = 'white';}else{lableColor = 'black'}
现在唯一的问题是它在刷新页面后发生了变化,而不是对 Web 开发人员来说是新的……我该如何实现这一点
options:{
scales:{
y:{
ticks:{
color: 'lableColor'
}
},
x: {
ticks:{
color: 'lableColor'
}
}
}
}