Detect dark mode

PHOTO EMBED

Wed Jan 05 2022 11:33:23 GMT+0000 (UTC)

Saved by @desiboli ##javascript ##js

const isDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
console.log(isDarkMode) // Result: True or False
content_copyCOPY

https://blog.devgenius.io/15-javascript-codes-you-will-always-need-e8569903dd1