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

Dark theme support #64

Open
wei opened this issue Nov 2, 2021 · 2 comments
Open

Dark theme support #64

wei opened this issue Nov 2, 2021 · 2 comments

Comments

@wei
Copy link

wei commented Nov 2, 2021

Thanks for the awesome theme!

Is there anyway we could add dark mode support now that Primer css supports both light and dark themes?

@markavitale
Copy link

I really like this theme too! I haven't found anything else that completely gets out of the way of the content like primer does.

I'd also love built in dark mode support, especially if it uses the prefers-color-scheme media selector to automatically swap between themes based on the user's system preferences.

On my site I've been using a hack I found on https://news.ycombinator.com/item?id=26472246 to just invert colors when in dark mode that works fairly well. The tradeoff is that I haven't figured out how to use images without some color distortion (even when trying to de-invert images specifically) so I've just given up on having images.

Just put this css into your default template:

/* set the background color to black when client requests dark mode and invert the colors
   from post by user lewisl9029: https://news.ycombinator.com/item?id=26472246
 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: black;
        filter: hue-rotate(180deg) invert(90%);
    }
}

https://github.com/markavitale/markavitale.github.io/blob/main/assets/css/dark-mode-override.css

@wanghenshui
Copy link

I really like this theme too! I haven't found anything else that completely gets out of the way of the content like primer does.

I'd also love built in dark mode support, especially if it uses the prefers-color-scheme media selector to automatically swap between themes based on the user's system preferences.

On my site I've been using a hack I found on https://news.ycombinator.com/item?id=26472246 to just invert colors when in dark mode that works fairly well. The tradeoff is that I haven't figured out how to use images without some color distortion (even when trying to de-invert images specifically) so I've just given up on having images.

Just put this css into your default template:

/* set the background color to black when client requests dark mode and invert the colors
   from post by user lewisl9029: https://news.ycombinator.com/item?id=26472246
 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: black;
        filter: hue-rotate(180deg) invert(90%);
    }
}

https://github.com/markavitale/markavitale.github.io/blob/main/assets/css/dark-mode-override.css

works with images color inverted, thank you

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

No branches or pull requests

3 participants