I trying to compare the styles of elements on my page. But one element dynamically changes it’s text color to red, but represented as a rgb value. And the other element (to compare it with) uses #123456 values. Is there a converter somewhere that can take rgb and turn it into #number?
For example:
#000 instead of rgb(0, 0, 0)
People always forget that rgb colors can be expressed as percentages, as well as integers.
// also works with arrays-
rgbToHex([100,200,60])
// returned value: #64c83c