Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript detect dark mode

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

console.log(isDarkMode) // Result: True or False
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #javascript #detect #dark #mode
ADD COMMENT
Topic
Name
4+4 =