cancel
Showing results for 
Search instead for 
Did you mean: 

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

SOLVED
Community Manager

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

Hi @royd,

 

Could you please mark the answer that help you as a solution? You see a big green "Accept as Solution" button next to it. It will help other community members who will face a similar situation. Thanks.

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Community Leader

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

While I was searching for something else I happened upon something and thought it might be of assistance to you.  The smartbear support for handling browser differences has a secion about attribute values that looks specifically at how to handle the background color in different browsers as an example

https://support.smartbear.com/testcomplete/docs/app-testing/web/general/cross-browser/handling-diffe...

 


-------------------------------------------------
Standard syntax disclaimers apply
Regards,
Regular Contributor

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

Hi Rudolph

 

Thanks for the link. This will help me understand what I am doing wrong.

 

Thanks. Smiley Happy

Community Leader

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

Glad it could help

 

What stood out to me is that it appears the style they are picking up is "backgroundColor" rather than "background-color"


-------------------------------------------------
Standard syntax disclaimers apply
Regards,
Regular Contributor

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

Hi Tanya

 

I always do, when I have found a solution! 

 

I  would like to take the opportunity to point out, that the users are always there to help, more than support people. Especially Robert has always been there and help solve 95% of my problems!! I can not thank him and all other experts that have helped me.

Regular Contributor

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

Hi Robert

 

Sorry for delayed response. It took me a while but finally figured it out. Thanks for pointing me to right direction. This is what finally worked:

 

var previewColor =  previewSwatch.ownerDocument.defaultView.getComputedStyle(previewSwatch, "").backgroundColor;
Community Manager

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

Hi @royd.

 

I'm so glad to hear that the solution has been found Smiley Happy

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
New Here?
Join us and watch the welcome video:
Top Kudoed Authors