tiddly-gittly / itonnote-theme

A notion like white theme, build for TiddlyGit default light experience, good for eyes in light environment.
https://tiddly-gittly.github.io/itonnote-theme/
MIT License
4 stars 1 forks source link

dark mode #10

Closed linonetwo closed 9 months ago

linonetwo commented 1 year ago

参考核心里的暗黑模式判断代码,我这应该就是用 $:/info/darkmode 即可。

    // Dark mode through event listener on MediaQueryList
    const mqList = window.matchMedia('(prefers-color-scheme: dark)');
    const getDarkModeTiddler = function() {
      return { title: '$:/info/darkmode', text: mqList.matches ? 'yes' : 'no' };
    };
    infoTiddlerFields.push(getDarkModeTiddler());
    mqList.addListener(function(event) {
      updateInfoTiddlersCallback([getDarkModeTiddler()]);
    });
linonetwo commented 9 months ago

好像不需要判断,直接改用 Nord 调色板就是暗黑模式了