detect dark mode os in js code example
Example: javascript detect dark mode
const isDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
const isDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;