Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect if user has prefers-dark-mode setting on #2

Open
coliff opened this issue Jul 3, 2019 · 8 comments
Open

Detect if user has prefers-dark-mode setting on #2

coliff opened this issue Jul 3, 2019 · 8 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@coliff
Copy link
Owner

coliff commented Jul 3, 2019

Requirements:

  • dark-mode-switch should detect the users system preference and use that unless they have already made a change to the switch (which is saved in local storage). So if someone has already set the dark mode switch on, but they have a light-mode set on their OS or browser preference it would prioritise the dark-mode-switch setting
  • I think this 'Detect if user has prefers-dark-mode setting on' feature should be enabled as standard in a v2 of this script, but open to suggestions if it should be an option.
@coliff coliff changed the title Detect if user has prefers dark mode setting on Detect if user has prefers-dark-mode setting on Jul 3, 2019
@coliff coliff added enhancement New feature or request help wanted Extra attention is needed labels Aug 8, 2019
@AlexanderMorou
Copy link

AlexanderMorou commented Sep 16, 2019

I think this is something browsers will adopt sooner than later:
See this stackoverflow answer.

In a cursory search, to check this via JavaScript you may follow this website's advice on a reactive JavaScript approach.

@telecomsxchange
Copy link

would be cool if we add a line of code to auto switch dark mode depending on time of the day. IF user local time passed sunset enable dark mode, else Light Mode.

@filipe-gomes
Copy link

I'd love to help out with this, if no one else is already working on it

@coliff
Copy link
Owner Author

coliff commented Nov 12, 2019

Hi @filipe-gomes - yes, go for it! I updated my original post with a couple of thoughts on the requirements.

@filipe-gomes
Copy link

Hi @filipe-gomes - yes, go for it! I updated my original post with a couple of thoughts on the requirements.

Thanks! I'm working on a project where I just implemented that. I will start looking into implementing this with the switch tonight after work.

popoway added a commit to popoway/dark-mode-switch that referenced this issue Dec 2, 2019
@cullub
Copy link

cullub commented Jul 10, 2020

Hi @coliff -- looks like @popoway found a pretty easy solution to this ^^. Is that something you/we can add to the main source here?

@Priya19999
Copy link

I would like to work on it.

@rugk
Copy link

rugk commented Jan 18, 2021

Is anyone already working on that?
We may, as we have a downstream issue at #2 implement this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants