Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

eventlistener dark mode

window.matchMedia('(prefers-color-scheme: dark)')
      .addEventListener('change', event => {
  if (event.matches) {
    //dark mode
  } else {
    //light mode
  }
})
Source by flaviocopes.com #
 
PREVIOUS NEXT
Tagged: #eventlistener #dark #mode
ADD COMMENT
Topic
Name
2+3 =