如何根据我的深色/浅色主题更改 chatsJs 的刻度线颜色和网格线颜色?

时间:2021-07-10 06:21:37

标签: javascript html css

我想根据主题更改标签和网格线的颜色..这是我更改主题的代码

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'
        
     }
   }
}

}

0 个答案:

没有答案