-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Feature Request: Night Mode #134
Comments
Hey Mebin, thanks for bringing this up. We're gonna backlog this for now as we prepare to open source. |
I've made a userstyle for myself recently, been using it for a while. Uploaded to userstyles.org now so you can check it out, nothing fancy but It'll do the job until we have a official night mode. https://userstyles.org/styles/163294/dev-to-night-mode |
@CanNuhlar Nice! I like what you did there. |
Thanks, @maestromac ! I'd like to add this feature as a PR but it looks like a devious work and would require work from multiple people I guess, also I don't know if @benhalpern and his team would approve the color scheme or the feature itself... The color scheme is complete ripoff from Twitter's night mode. |
@CanNuhlar super in favor of the color scheme. I think it needs to be refined, but we can do that. What I care more about is how this will technically work. We'll have a setting on the user's profile, but we don't render the page from origin based on the user. Basically we load straight from the CDN and then load user data. So I think this should be inserted at either:
I'd prefer service worker I think because it would be modestly more scalable. It's slightly less clear to me exactly how we'd do it but I'd love to go down that road and figure it out. This is sort of separate from the concerns at the CSS layer. So we could start with just making this work some how with the CSS and go from there. |
What's the status of this feature ? |
Hey @dimensi0n , this issue is up for grab! |
Can I work on this? |
Hey @joybhallaa , someone already submitted a PR (#1104) for this issue. You are welcomed and encouraged to review it! |
And for my 2 cents, I think we should use CSS variables for themes, then load in a theme css file body {
background: var(--theme-body-background, #FFFFFF)
} :root {
--theme-body-background: #303030;
--theme-container-background: #424242;
--theme-container-color: #FFFFFF;
} This would be a lot of effort to start with but it does mean we could offer many themes, down the line, or even let users come up with their own. |
It would be neat if this could be automatically enabled for https://medium.freecodecamp.org/how-to-get-dark-mode-working-with-css-740ad31e22e |
@abraham agreed, I think that's probably the path we'll take 😁 |
Speaking of how to do this, I think, as a default, we should have it change with the system theme but also let users pick a theme and stick with it. I don't know much about ruby on rails but is it possible to generate a css file based on user preferences? |
I'm not familiar with that feature but i know it's possible to pass instance variable. I'm also wondering if edge caching might have an issue with this. |
It's possible to set and change css variables with javascript though I think it would be preferable to try and load in the CSS from the back end but if it's not possible this may be a solution. Set variable: https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration/setProperty document.documentElement.style.setProperty('--theme-background', user.background) Detect media query: https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia const theme = window.matchMedia("(prefers-color-scheme: dark)");
theme.onchange = e => {
if (e.matches) {
/* The computer has a dark theme set */
} else {
/* The computer has not got a dark theme set */
}
} |
Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue in 7 days. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If this issue still requires attention, please respond with a comment. Happy Coding! |
Resolved with #2072 |
Feature Request
It would be awesome if there was a "night mode" which would switch the site's colors to a darker version which would look better under some conditions.
The text was updated successfully, but these errors were encountered: