Is there a way to check if two strings representing colors are hexadecimal, rgb, rgba or in word form are equal.
For example, they will be equal
"red" and "# ff0000"
"red" and "# f00"
"red" and "rgb (255, 0, 0)"
"# ff0000" and "rgba (255, 0, 0, 255)"
What I'm trying to do is combine two or more elements together if their colors are the same, but sometimes the colors are presented differently.
I checked the equality of the string element.style.color, but then I ran into this problem. Would be better with a different approach?
The answer to the question, and only out of curiosity, is one browser the "dark blue" rgb value equal to other browsers of the "dark blue" rgb value for all colors?
source
share