Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

启动检测黑暗模式 #96

Open
oeyoews opened this issue Oct 12, 2023 · 2 comments
Open

启动检测黑暗模式 #96

oeyoews opened this issue Oct 12, 2023 · 2 comments

Comments

@oeyoews
Copy link

oeyoews commented Oct 12, 2023

$tw.wiki.filterTiddlers('[{$:/palette}field:color-scheme[dark]]')

这里使用 $:/info/darkmode 判断是不是更合适

@oeyoews
Copy link
Author

oeyoews commented Oct 12, 2023

echarts 现在似乎不支持动态改变theme apache/echarts#18198

下面是暂时借助tailwindcss实现的动态切换

<div class="dark:hidden">
<$echarts $tiddler="sevenday.js" $theme='light'/>
</div>

<div class="hidden dark:inline">
<$echarts $tiddler="sevenday.js" $theme='dark'/>
</div>

@oeyoews
Copy link
Author

oeyoews commented Oct 12, 2023

@Gk0Wk 可以直接在 onUpdate 函数里面像widget那样直接 重新刷新当前dom吗, 比如使用refreshSelf, 这样应该直接可以监听系统主题的变换,从而动态切换echart的主题了

ps: 感觉可以把监听事件直接写在echart的widget里面,这样每个addon就不用自己再判断一遍了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant