Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

detect dark mode javascript

if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
    console.log(` is dark`);
}else{
  console.log(`shiit is light`);
}
Source by 1loc.dev #
 
PREVIOUS NEXT
Tagged: #detect #dark #mode #javascript
ADD COMMENT
Topic
Name
5+4 =