Possible duplicate:
Javascript function to convert color names to hexadecimal codes
Is it possible to get or calculate the value of the hexadecimal value that the browser currently uses for the named color? For example, I would like to do something like the following:
(HTML):
<div id="container" style="background-color: lightgreen"></div>
(JavaScript):
var container = document.getElementById("container"); var colorAsHex = getHexColor(container, "background-color");
At best, I hope for a jQuery solution that I just miss. In the worst case, I am very good at browsers, while I can reach 4 major browsers.
source share