How to find good looking font color if background color is known?
There seem to be so many color wheel, color picker, and color matcher web apps out there, where you give one color and the they'll find a couple of other colors that will create a harmonic layout when being used in combination. However most of them focus on background colors only and any text printed on each background color (if text is printed at all in the preview) is either black or white.
My problem is different. I know the background color I want to use for a text area. What I need help with is choosing a couple of colors (the more, the merrier) I can use as font colors on this background. Most important is that the color will make sure the font is readable (contrast not being too low, also maybe not being too high to avoid that eyes are stressed) and of course that the combination of foreground and background just looks good.
Anyone being aware of such an application? I'd prefer a web application to anything I have to download. Thanks.
If you need an algorithm, try this: Convert the color from RGB space to HSV space (Hue, Saturation, Value). If your UI framework can't do it, check this article: http://en.wikipedia.org/wiki/HSL_and_HSV#Conversion_from_RGB_to_HSL_or_HSV
Hue is in [0,360). To find the "opposite" color (think colorwheel), just add 180 degrees:
h = (h + 180) % 360;
For saturation and value, invert them:
l = 1.0 - l;
v = 1.0 - v;
Convert back to RGB. This should always give you a high contrast even though most combinations will look ugly.
If you want to avoid the "ugly" part, build a table with several "good" combinations, find the one with the least difference
def q(x):
return x*x
def diff(col1, col2):
return math.sqrt(q(col1.r-col2.r) + q(col1.g-col2.g) + q(col1.b-col2.b))
and use that.
I suggest you to try some colors that looks good for you (using one of the tools suggested by others in the answers if you want), but don't forget that color blindness exists, so test your page at this address:
http://colorfilter.wickline.org/
Check out kuler, it's a great resource for finding colors that go well together, just do a search for the HTML color code (eg. FF9900). It won't limit the result to only sets that include high-contrast colors with the one you selected, but the sets typically will have a combination of low and high contrast colors.
链接地址: http://www.djcxy.com/p/87322.html上一篇: 字体只有黑色和白色