Friday, March 1, 2019

accessibility - Best Way to Darken a Color Until it is Readable?



What's the best way to darken a color until it is readable?


I have a series of titles which have an associated color, but some of these colors are very light and any text drawn in them is unreadable. I've been messing around with HSB and I can't seem to get an algorithm down that darkens the color without making it look silverish.


I think I want to alter the saturation too. Is there a standard way of doing this?



Answer



With HSB, you generally reduce B to get a darker version of a given color, and possibly increase S as you go if the color looks too dull. This works for most colors except yellow (it ends up as an ugly muddy color), but only because there's no such thing as "dark yellow."


I don't know why you'd get silverish unless your starting color is white, but it's fair to say silver is "dark white," just like brown is "dark orange."


If you still don't like the results, don't change your colors but instead use black text on light backgrounds and white text on dark backgrounds. See Choosing high contrast text color (in relation to background color) dynamically.


No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...