-
Notifications
You must be signed in to change notification settings - Fork 2k
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
CSS 在夜间模式/深色模式中的使用与探索 #73
Comments
转换后有内味儿了 |
@TrumanGu 还在探索中 😂 |
可以通过 Media Query 查询 prefers-color-scheme 属性来检测用户系统的主题。 |
可以用css atrribute+css变量来做,类似这样: |
这个在低版本一点android的webview就存在很大问题了,不支持attribute的属性,直接挂球 |
本文未完成....
法一:使用 filter: invert
主要借助 invert 这个滤镜实现,定义一个
.dark-mode-invert
挂载在全局根元素<html>
上:图片不能使用
filter: invert
处理,需要再 invert(100%) 转变回来。尝试使用掘金作为例子试了下:
转换前:
转换后:
缺点:
法二:使用混合模式 mix-blend-mode: difference
The text was updated successfully, but these errors were encountered: