Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert Color Name
function convertColorName (name) {
var testEl = document.createElement('div'),
rgb;
testEl.style.backgroundColor = name;
rgb = document.body.appendChild(testEl);
rgb = window.getComputedStyle(testEl).backgroundColor;
document.body.removeChild(testEl);
return rgb;
}
/*
var salmon = converColorName('salmon');
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.