This was a surprise. The following code does not seem to give me the actual colors on the screen:
h1 = document.querySelector("h1");
window.getComputedStyle(h1).color
Gives rgb(0, 0, 0)
which I think is correct. However
window.getComputedStyle(h1).backgroundColor
gives rgba(0, 0, 0, 0)
. The actual background color I see on the screen is white.
The element I call h1 is visible on the screen. I was expecting to get the actual background color. The value I get above (in rgba) is not wrong, but not very useful either. It just tells me the background is fully transparent - and that is not a color.
How do I get the actual background color in RGB?