简体   繁体   English

如何动态计算正确的RGB颜色以与背景色形成对比?

[英]How do I dynamically calculate the right RGB colour to contrast with a background colour?

I´m trying to understand how I would recreate the functionality here where the colour of the text changes as hte background colour changes - such that the colour is consistantly visble : 我试图了解如何在此处重新创建功能,在此功能中,文本的颜色会随着背景颜色的变化而变化-这样颜色就始终具有可见性:

http://colourco.de/ http://colourco.de/

This is HSL implementation, with fixed Saturation = 50% 这是HSL实施,具有固定的饱和度= 50%

X-axis changes Hue value from 0-359 X轴将色相值从0-359更改为

Y-axis changes luminosity from 0%-100% Y轴的亮度从0%-100%更改

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

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