本文共 1333 字,大约阅读时间需要 4 分钟。
opencv 图像黑暗
Using CSS it’s pretty easy to apply changes if the system is in dark mode, using the prefers-color-scheme
media feature.
如果系统处于黑暗模式,则使用CSS可以很容易地应用更改,使用prefers-color-scheme
媒体功能。
Check my blog post on if you want to learn more about it.
如果您想了解更多有关信息,请查看我的博客文章。
Today I run into a problem - how to change an image defined in the HTML, rather than a CSS rule?
今天,我遇到了一个问题-如何更改用HTML而不是CSS规则定义的图像?
Turns out there’s a plain HTML way to do that, without any CSS or JavaScript involved.
事实证明,有一种简单HTML方式可以做到这一点,而无需涉及任何CSS或JavaScript。
We can use the picture
tag to wrap the img
tag:
我们可以使用picture
标签来包装img
标签:
If dark mode is supported and enabled, the dark.png
image will be used as the source for the img
tag.
如果支持并启用了暗模式,则dark.png
图像将用作img
标签的源。
The tag is very well supported, and old browsers that do not implement it, or do not implement dark mode, will fall back to displaying the light.png
image.
很好地支持该标签,并且未实现该标签或未实现暗模式的旧浏览器将退回到显示light.png
图像。
It’s important to note that the browser does not download 2 images, in any case: if it’s dark mode, in this example it will just download the dark.png
image, and if it’s light mode, it will download only light.png
, so there’s no waste of bandwidth.
需要特别注意的是,在任何情况下,浏览器都不会下载2张图像:如果是暗模式,在此示例中,它将仅下载dark.png
图像;如果是亮模式,则仅下载light.png
,因此不会浪费带宽。
翻译自:
opencv 图像黑暗
转载地址:http://oomgb.baihongyu.com/