Measuring the luminosity or lightness in a color

While preparing my css templates, I find sometimes that the color I am working on needs a dark background or a light background to enhance readability.

So, how do you find out if the color you have reaches the luminosity threshold?

Use math! You can take the Hex code of the color and play with it. You can find a simple javascript code to do it here: http://stackoverflow.com/questions/12043187/how-to-check-if-hex-color-is-too-black

And an explanation of what lum is, in Wikipedia: http://en.wikipedia.org/wiki/Rec._709#Luma_coefficients

Advertisements

2 thoughts on “Measuring the luminosity or lightness in a color

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s