GitHub 6248★

Detect dark mode

JavaScript version

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

TypeScript version

const isDarkMode: boolean = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
Follow me on and to get more useful contents.