Share your advanced knowledge/code with the community.
Dirk Geppert
 
Posts: 138
Joined: Fri Sep 22, 2017 7:02 am

Detect Darkmode

by Dirk Geppert Mon Oct 28, 2019 2:03 pm

If you want to dynamically adjust your webapp to the user's preferred color scheme:

Code: Select all
! if(matchMedia('(prefers-color-scheme: dark)').matches) {
  Debug "Darkmode"
! }
 
! if(matchMedia('(prefers-color-scheme: light)').matches) {
  Debug "Lightmode"
! }
Fred
Site Admin
 
Posts: 1182
Joined: Mon Feb 24, 2014 10:51 am

Re: Detect Darkmode

by Fred Tue Nov 05, 2019 10:33 am

Cool stuff !
Return to Tricks 'n' Tips

Who is online

Users browsing this forum: No registered users and 1 guest