-1

element.style.color will be whatever the stylesheet specifies, rgba(121, 110, 12, 14);, or rgb(... or hsl, #afd544 etc.

How can I convert element.style.color to some standard, comparable value (RGB-triple or hex string for example) using JavaScript?

theonlygusti
  • 11,032
  • 11
  • 64
  • 119

1 Answers1

1

You can try using window.getComputedStyle(element).getPropertyValue('color').

Should give you the color property in the unified rgb(r, g, b) format.

2DH
  • 1,648
  • 2
  • 10
  • 19