Forum Discussion

royd's avatar
royd
Regular Contributor
7 years ago
Solved

Trying to get Hex/RGB value of a color preview swatch, please help!

Hi everyone

 

In configuration page some colors are customizable. 

  • When clicked on any of the input fields, a color chooser pops up.
  • Selecting a color populates the field with the hex value.
  • The preview swatch updates to the selected color.

I am trying to access the hex value of the preview color. After some reading, this is what I came up with:

(I have noticed that swatch value shows up as Hex in Chrome but as RGB in IE!)

 

  var colorPrimary = page.QuerySelector(".evo-colorind");
  var style = page.contentDocument.defaultView.getComputedStyle(colorPrimary, "");
  Log.Message(style.background-color);

 

 

 

I am getting JavaScript runtime error 0x80020101 at 'style' var. Any help deeply appreciated.