There are already some stackoverflow questions about that, and multiple
django plugins to do that. They basically just force light theme in css,
while a more evolved one stores user preference in database.
https://stackoverflow.com/questions/67193106/disable-prefers-color-scheme-
dark-in-django-admin
https://stackoverflow.com/questions/68159768/disable-dark-mode-in-django-
admin
https://pypi.org/project/django-non-dark-admin/
https://pypi.org/project/django-light/
--
Ticket URL: <https://code.djangoproject.com/ticket/33690>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: Sarah Abderemane, jefftriplett (added)
* stage: Unreviewed => Accepted
Comment:
This keeps coming up so we should likely accept the change here.
There's a related PR for djangoproject.com
https://github.com/django/djangoproject.com/pull/1158 — whatever switch we
develop for there should be applied here too.
There was some discussion on Twitter where the consensus seemed to be to
Follow the system setting, but allow an override — that should guide
implementation.
(e.g. https://twitter.com/webology/status/1514760882605109276)
--
Ticket URL: <https://code.djangoproject.com/ticket/33690#comment:1>
* owner: nobody => Sarah Abderemane
* status: new => assigned
Comment:
I have done that on the related PR, it's taking the default os preference
and there is a button to force the switch over system preference. I just
need to do some improvements suggested in the PR.
I add the user preference in the local storage for djangoproject.com but
for the admin it can be in the database or same as djangoproject.com, in
local storage or other suggestion.
What do you think ?
As the admin has already a dark theme, I can handle it, before the change
for djangoproject.com and adjust if needed.
--
Ticket URL: <https://code.djangoproject.com/ticket/33690#comment:2>
Comment (by Carlton Gibson):
Hi Sarah. I think local storage is fine (great even). Thanks!
--
Ticket URL: <https://code.djangoproject.com/ticket/33690#comment:3>
Comment (by nv35):
Hi, thanks for your replies. I guess there are 2 different features that
are missing :
- possibility to disable dark theme completely on a site
- give the user the possibility to switch between dark and light, and
store the choice
I've created ticket initially for the first one, perhaps a second ticket
have to be created for the other? Thanks
--
Ticket URL: <https://code.djangoproject.com/ticket/33690#comment:4>
* cc: Florian Demmer (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/33690#comment:5>
Comment (by Sarah Abderemane):
Hi nv35,
> I've created ticket initially for the first one, perhaps a second ticket
have to be created for the other?
No need to create another ticket, in my opinion, it's only the fact that
your ticket involved to be sure that it will fit everyone.
> give the user the possibility to switch between dark and light, and
store the choice
By doing this, you will have a way to disable the dark theme, even if you
have set your os preference on the dark theme, and the theme change will
be visible to everyone on the admin.
--
Ticket URL: <https://code.djangoproject.com/ticket/33690#comment:6>
Comment (by Sarah Abderemane):
[https://github.com/django/django/pull/15843 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/33690#comment:7>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/33690#comment:8>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/33690#comment:9>
* needs_better_patch: 1 => 0
Comment:
It looks like comments have been addressed. Unchecking PNI for another
review.
--
Ticket URL: <https://code.djangoproject.com/ticket/33690#comment:10>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/33690#comment:11>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"bc7aa2a5e91cf65fc7510edaf1776528c7ad07b4" bc7aa2a5]:
{{{
#!CommitTicketReference repository=""
revision="bc7aa2a5e91cf65fc7510edaf1776528c7ad07b4"
Fixed #33690 -- Added switch button for dark mode in the admin.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33690#comment:12>
Comment (by GitHub <noreply@…>):
In [changeset:"640283711e6c8d25ad0e3c97453cd178a3e4d6a6" 64028371]:
{{{
#!CommitTicketReference repository=""
revision="640283711e6c8d25ad0e3c97453cd178a3e4d6a6"
Refs #33690 -- Added missing data-theme selector to example in theming
support docs.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33690#comment:13>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"effd704a1c19352f8d437ae3ed8852f4022133b4" effd704]:
{{{
#!CommitTicketReference repository=""
revision="effd704a1c19352f8d437ae3ed8852f4022133b4"
[5.0.x] Refs #33690 -- Added missing data-theme selector to example in
theming support docs.
Backport of 640283711e6c8d25ad0e3c97453cd178a3e4d6a6 from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33690#comment:14>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"e9acdff46298f99a2f234a376f6177e7c3216e7d" e9acdff]:
{{{
#!CommitTicketReference repository=""
revision="e9acdff46298f99a2f234a376f6177e7c3216e7d"
[4.2.x] Refs #33690 -- Added missing data-theme selector to example in
theming support docs.
Backport of 640283711e6c8d25ad0e3c97453cd178a3e4d6a6 from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33690#comment:15>
Comment (by GitHub <noreply@…>):
In [changeset:"c65f49d3cb8709f2f694f78b4849bc7693e90416" c65f49d]:
{{{
#!CommitTicketReference repository=""
revision="c65f49d3cb8709f2f694f78b4849bc7693e90416"
Refs #33690 -- Updated tutorial for admin dark mode toggle.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33690#comment:16>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"ef8234aef8f8473cb4fb79aec29e5a9445a32114" ef8234a]:
{{{
#!CommitTicketReference repository=""
revision="ef8234aef8f8473cb4fb79aec29e5a9445a32114"
[5.0.x] Refs #33690 -- Updated tutorial for admin dark mode toggle.
Backport of c65f49d3cb8709f2f694f78b4849bc7693e90416 from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33690#comment:17>