Get the actual computed style of an element. This factors in browser default stylesheets as well as external styles you’ve specified.
var elem = document.querySelector('#some-elem');
var bgColor = window.getComputedStyle(elem).backgroundColor;
Source
https://vanillajstoolkit.com/reference/style/window-getcomputedstyle/