I am getting the color property of an element using:
getComputedStyle(element).getPropertyValue(
"color"
);
which gives me the rgb color code, Is there a way to get this in hex format? since I am traversing the whole DOM so I want to save some effort of converting each of them to hex value using some custom function.
Edit: I have gone through the other answers, but that's not what I am looking for. I want to get it from the element rather than converting all of them later on.