Given some text:
<div>text</div>
I would like to detect when the computed CSS property color
changes for this div
.
There could be a number of css queries that would change its color, like media queries:
div {
color: black;
@media (prefers-color-scheme: dark) {
color: white;
}
@media screen and (max-width: 992px) {
background-color: blue;
}
}
Or perhaps a class applied to a parent:
div {
}
body.black {
color: white;
}
How can I, using Javascript, observe this change of computed style?