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 mode #188
Conversation
in OS preferences. I will be using it myself and fix things until I find out that this is adequate to merge to develop.
This just queries the browser whether `prefers-color-scheme` is set and chooses dark mode if needed, and only if the user hasn't manually set a scheme by pushing the button.
`prefers-dark-mode` header. I think I have covered all the bases.
confirmed working: firefox 69.0.1 it looks like there are issue with chromium/chrome on linux using gtk themes that are still being ironed out, so it will work eventually. see https://bugs.chromium.org/p/chromium/issues/detail?id=1004246 |
Thanks for taking the time to explore this, @qwazix! I like the idea in theory, but I'm still thinking about if this should be in the core platform. Just some thoughts below. I do like the idea of the system setting the default mode of the pad -- I think that's a great use case for dark mode that we could incorporate today. But I'm very hesitant to change the entire site (especially the reading experience) to respect the mode. A few reasons:
Considering all of this (and barring any other input), I think we should keep the part where the system setting determines the initial Pad theme, and then separately publish your CSS in our external resources. That way, instance admins and blog users can include it if they want their WF instance or blog to support dark mode. |
Ok perfect I will separate the changes into two branches. |
I think we should leave this out of the default stylesheet, mostly because it'll make customization much more difficult for users. But I think it'd make a great addition to our Themes showcase! So if you put this into a standalone style that we can feature there, then we'll do that. Otherwise, I still think dark mode makes sense in the editor. So we'll continue that work in #196. |
The code for the front-end is as follows, anywhere better that I should put it? @subheadersDark: #aaa;
@headerTextColorDarkMode: #cfcfcf;
@textLinkColorDark: rgb(162, 162, 255);
:root {
color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
body{
color: #eee;
background: #111;
.post-title a:link{
color: #ccc;
}
&#collection{
color: #eee;
pre{
background: #060606;
}
}
h1, header h2 {
a {
color: @headerTextColorDarkMode;
&:hover {
color: #fff;
}
&:visited {
color: @headerTextColorDarkMode;
}
}
}
#nav#manage ul a, .dropdown-nav ul a, nav#manage ul ul a, nav#manage ul a{
color: #ccc;
}
.dropdown-nav ul ul, .dropdown-nav ul li:hover, nav#manage ul ul, nav#manage ul ul li:hover, nav#manage ul li:hover{
background: #222;
}
#official-writing h2, #official-writing h3, #official-writing h4, #wrapper h2, #wrapper h3, #wrapper h4{
color: #ddd;
}
a {
color: @textLinkColorDark
}
a:visited{
color: rgb(201, 138, 253);
}
#official-writing, #wrapper {
h2, h3, h4 {
color: @subheadersDark;
}
ul {
&.collections {
li {
&.collection {
a.title {
&:link, &:visited {
color: @headerTextColorDarkMode;
}
}
}
a.create {
color: @subheadersDark;
}
}
}
}
}
}
body#me #official-writing h2 a:link, body#me #official-writing h2 a:visited{
color: @textLinkColorDark
}
.ace_editor {
border: 1px solid #333;
}
input {
background: #202020;
color: #bbb;
}
nav#manage ul ul li img{
filter: invert(1);
}
.alert {
&.info {
color: #4295be;
background-color: #0a0b0c;
border-color: #181d1f;
}
&.success {
color: #5bb35c;
background-color: #282b27;
border-color: #21241e;
}
}
} |
Here works! We'll just need to compile it into CSS -- looks like it's still in LESS form. |
This adds dark mode css to writefreely which gets enabled automatically when the OS is set to dark mode (
prefers-color-scheme: dark
media query). It also leverages the built in pad dark mode functionality to choose the dark pad by default ifprefers-color-scheme
isdark
.That is all. I tried to just invert the colors and not do any other stylistic choices.