Similar Question:
Javascript function to convert color names to hex codes
Is there a way to determine the hexadecimal value of a named color that is currently being used by the browser? For example, I would like to achieve something similar to this:
(HTML):
<div id="container" style="background-color: lightgreen"></div>
(JavaScript):
var container = document.getElementById("container");
var colorAsHex = getHexColor(container, "background-color");
Ideally, I am looking for a jQuery solution that I might be overlooking. Otherwise, I am open to browser-specific workarounds as long as it is compatible with the major browsers.