简体   繁体   English

使用 HTML CSS 根据背景对比度在两种颜色之间切换

[英]Switch between two color based on background contrast using HTML CSS

在此处输入图像描述

I am trying to implement a range display, like in the image and the main challenge I am facing is to dynamically switch the font color of value when its background is darker.我正在尝试实现范围显示,就像在图像中一样,我面临的主要挑战是在其背景较暗时动态切换 value 的字体颜色。

I have already tried mix-blend-mode: difference;我已经尝试过mix-blend-mode: difference; , but it doesn't help. ,但它没有帮助。

I want the font color to switch only between the two colors displayed in the image.我希望字体颜色仅在图像中显示的两种颜色之间切换。

当进度条超过 0% 时,您可以硬编码字体颜色以更改

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM