-
Notifications
You must be signed in to change notification settings - Fork 321
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
Set up a Dark theme #501
Set up a Dark theme #501
Conversation
- I used the recommendation from here: https://css-tricks.com/a-complete-guide-to-dark-mode-on-the-web/#using-php-cookies - tested the validity of my set colors: https://wave.webaim.org - desaturated all the colors: https://mdigi.tools/desaturate-color/#b3571b - create fixed pygment stylesheet - move colors to a separeted stylesheet - default to black for test purposes
agreed this would be really great - did you happen to see #273 or take a look at all? |
I actually did but that was done too far away from the current master branch so I decided to start back from there. Main differences are the following:
|
Sounds good - well ping when you're ready for somebody to take a look - the demo looked pretty nice to me! A couple quick thoughts:
|
Closing this one in favor of #540 |
Description
I think it would be super usefull as more and more tools on the web are starting to use this light/dark theme to improve UX.
In this PR I tried to create a dark theme (there is still work to do on the variables, some are still set directly in the css).
This dark theme can be triggered by the user preferences and/or using the little btn in the navbar. The user defined value has the priority over the system.
Here is a GIF to show how it works:
design discussion
That's the first time I'm working on CSS so I followed all the recomendation from https://css-tricks.com/a-complete-guide-to-dark-mode-on-the-web/#using-php-cookies.
method
2 methods for switching from a theme to another sounds promising to me :
1/ using a different set of stylesheet
2/ add a class (
dark
) to the root element and write twice all the colors and font variablesI decided to go for the first one as it allows eventually to go for more than 2 theme but I you prefer to keep it simple with only 1 css file I can port back everything to
theme.css
coloring
For the coloring I tried to remove all the colors that were defined in the scss and use variables instead, bringing them all back to the theme.css file. I did a first draft, I'm happy to hear what works and what doesn't according to you (note that I'll continue working on it in the next days).
As a rule of thumb I understand that the colors need to be desaturated so I used this tool : https://mdigi.tools/desaturate-color/#b3571b
pygment
Pygment is an issue as to create 2 themes I need to fix the Pygment css. I used Native and default for my example
Also I remove the shadows in the dark theme for obvious reasons
shadows
everything that have shadow have been lightened from the dark background to reproduce the depth without the issue of white shadows
Todo
conf.py
for people that want to fix the theme (choice between 'dark', 'light' for the init theme and a booleanenble_change
.PS
sorry for the commit duplication I stupidely coded my previous PR on my fork master branch (lucky me it as been accepted)