Skip to content

How to change dark mode as default in mobile environment? #670

Closed Answered by rohandebsarkar
SHC02 asked this question in Q&A
Discussion options

You must be logged in to vote

Change the following line

if (userPref && userPref('(prefers-color-scheme: dark)').matches) {

to:
if ((userPref && userPref('(prefers-color-scheme: dark)').matches) || userPref('(max-width: 768px)').matches) {

This will set a default dark theme for mobile and tablet devices.

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@SHC02
Comment options

@SHC02
Comment options

@rohandebsarkar
Comment options

Answer selected by SHC02
Comment options

You must be logged in to vote
1 reply
@adityajain93
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants