.css文件
@media (prefers-color-scheme: dark) {
:root {
color-scheme: light dark;
filter: invert(100%);
-webkit-filter: invert(100%)
}
}
这在WKWebView中看起来如何
最佳答案
添加表格标签后,表格数据颜色正确反转
@media (prefers-color-scheme: dark) {
// root tag inverting all the components color except the table.
: root {
color-scheme: light dark;
filter: invert(100%);
-webkit-filter: invert(100%)
}
//table tag needed for inverting table content.
table {
filter: invert(100%);
}
}