Home » Jquery » jquery – CSS: get color from angular

jquery – CSS: get color from angular

Posted by: admin February 22, 2020 Leave a comment


From jquery we can take the color from an element like this


in angular 2+ is any workaround to get the hex color?

How to&Answer:

You can get it with vanilla js like this. The getPropertyValue is not necessary, but the getComputedStyle will return all css for the element, that’s why I wrote it there.

getComputedStyle(element, null).getPropertyValue('color')


getComputedStyle(element, null)['color']