色彩对比公式 ? (图像魔术师)
我将图像减少到 12 种颜色,并用一些文本注释(这里是颜色饱和度,已排序):
文本颜色为%[pixel:p{10,10}*2]
(背景*2)(我制作了一个小脚本,如果您感兴趣,我可以分享)。
正如您所看到的,在所有情况下(颜色),文本的可读性(对比度)都不是很好。有没有比简单的线性缩放更智能的公式来使文本在所有/大多数情况下弹出?
I reduced an image to 12 colors, annotated with some text (here it's color saturation, sorted) :
The text color is %[pixel:p{10,10}*2]
(background *2) (I made a little script that I can share if you're interested).
As you can see, text is not very readable (contrast) in all cases (colors). Is there a smarter formula than a simple linear scaling to make text pop in all/most cases ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 Fred 的建议,使用亮度要好得多。使用黑色和白色文本取决于亮度> 56 或以上:
对于非彩色图像:
文本代表 HSL 值的 L 分量。请注意当值超过 56 时从黑色变为白色的变化。
As per Fred's suggestion, using luminosity is much better. Using black & white text depending on luminosity > 56 or not :
And for a not colorful image :
The text represents L component of HSL value. Notice the change from black to white when value crosses 56.