I needed to monitor for changes to `color-scheme` in an embed and found this super handy little library. It needs `transition-behavior: 'allow-discrete'` which has ~73% support. I wrote a small fallback using polling for the older browsers but luckily support for `CSS.supports` is pretty decent!
Introducing @bramus/style-observer, a MutationObserver for CSS. It allows you to attach JavaScript callbacks to changes in computed values of CSS properties. 🔗 bram.us/2024/08/31/i...
2 reposts10 likes