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

Adaptive dark theme #299

Closed
fifty8 opened this issue Apr 14, 2020 · 5 comments
Closed

Adaptive dark theme #299

fifty8 opened this issue Apr 14, 2020 · 5 comments

Comments

@fifty8
Copy link

fifty8 commented Apr 14, 2020

It'd be great to add adaptive dark mode styles based on prefers-color-scheme CSS modifier.

@jdanyow
Copy link
Member

jdanyow commented May 6, 2020

that's a great idea

@raprocks
Copy link

raprocks commented May 8, 2020

@jdanyow any update? Or can i use any workaround until then?

@SwapnilSoni1999
Copy link

SwapnilSoni1999 commented May 9, 2020

you can do with javascript here's example

    const dark = window.matchMedia('(prefers-color-scheme: dark)').matches;
    const currTheme = dark ? 'github-dark' : 'github-light';
    const skript = document.createElement('script');
    skript.src = "https://utteranc.es/client.js";
    skript.crossOrigin = "anonymous";
    skript.async = true;
    skript.setAttribute('repo', "username/username.github.io");
    skript.setAttribute('issue-term', "pathname");
    skript.setAttribute('theme', currTheme);
    document.body.appendChild(skript);

@raprocks
Copy link

raprocks commented May 9, 2020

@SwapnilSoni1999 thnx for this, it works perfectly

@jdanyow
Copy link
Member

jdanyow commented May 10, 2020

Shipped 🕶️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants