Click to See Complete Forum and Search --> : JavaScript: Making color lighter


Ipsens
January 12th, 2009, 10:53 AM
<label for="biz_name">Bussines name</label>
Color and all other properties for label element have been set in external CSS file.
Minimizing markup!

I need a JS script, which will:
a) get activated / triggered when label element is being hovered.
b) obtain a color of label element.
c) make that color lighter, of that label element (no matter what color is in question)

Color is hex! :wave:

PeejAvery
January 12th, 2009, 11:42 AM
What's so hard about this? All you will be doing is using the onmouseover and onmouseout events mixed with a custom JavaScript function. In that function, use parseInt(x, 16) to work with the hexadecimal numbers.

Ipsens
January 16th, 2009, 11:00 AM
Problem is that I don't know, "how much" should I add or subtract from current color, to make it lighter

PeejAvery
January 16th, 2009, 02:33 PM
Any amount you add will make it lighter. Just play around with the amount until you get results you like.

Ipsens
January 16th, 2009, 02:39 PM
Ok, thanks!
;)