View Full Version : Darken Hex Color?

09-06-2006, 03:10 PM
Ok, I have a function being passed hex color values, however I need them a bit darken than what they actually are (think #eaeaea instead of #ffffff). So I guess my question is this, can this be done with JS?

I was thinking I could just convert the hex to RGB somehow and then add '20' or whatever onto each value so long as its not greater than 235. Or SOMETHING along those lines.

Will this work, and if so does anyone know of a good script to start with for RGB conversion?

Cheers!! :p

09-06-2006, 03:37 PM
ah...! i found this after a little diggin' Works great!

http://www.codingforums.com/archive/index.php?t-86375.html (http://www.codingforums.com/archive/index.php?t-86375.html)