Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Detect Dark Mode

const isDarkMode = () =>
  window.matchMedia &&
  window.matchMedia("(prefers-color-scheme: dark)").matches;
// Testing
console.log(isDarkMode());
Source by tapajyoti-bose.medium.com #
 
PREVIOUS NEXT
Tagged: #Detect #Dark #Mode
ADD COMMENT
Topic
Name
7+4 =