-
Notifications
You must be signed in to change notification settings - Fork 6
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 Implementation #83
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: Aarush Deshpande <[email protected]>
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed in person, can you add a test for the view to make sure it changes the dark mode?
Information on writing tests can be found on the website: https://tjcsl.github.io/tin/contributing/tests.html
@@ -8,6 +8,10 @@ | |||
{% include "meta.html" %} | |||
|
|||
<link rel="stylesheet" href="{% static 'css/base.css' %}"> | |||
{% if request.user.dark_mode %} | |||
<link rel="stylesheet" href="{% static 'css/dark/base.css' %}"> | |||
<link rel="stylesheet" href="{% static 'css/dark/edit.css' %}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dark/edit.css
should only be loaded wherever edit.css
is loaded. The way I suggest doing this is adding a context processor that adds the context variable dark_mode_enabled
to every template, and use that to optionally load themes.
More information here
https://docs.djangoproject.com/en/4.2/ref/templates/api/#using-requestcontext.
Then, wherever edit.css
is loaded, just do
{% if dark_mode_enabled %}
{# link dark/edit.css #}
{% endif %}
Closes #2