javascript detect dark mode
snippet in javascript

javascript detect dark mode

user8238

const isDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;