[Django] #33182: Enable dark mode in a easy way

138 views
Skip to first unread message

Django

unread,
Oct 9, 2021, 4:40:35 AM10/9/21
to django-...@googlegroups.com
#33182: Enable dark mode in a easy way
-------------------------------------+-------------------------------------
Reporter: Matteo | Owner: nobody
Vitali |
Type: | Status: new
Cleanup/optimization |
Component: | Version: 3.2
contrib.admin |
Severity: Normal | Keywords: admin dark schema
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 1 |
-------------------------------------+-------------------------------------
I would suggest improving dark schema enablement in a simple way through a
SiteAdmin attribute

--
Ticket URL: <https://code.djangoproject.com/ticket/33182>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 9, 2021, 4:41:38 AM10/9/21
to django-...@googlegroups.com
#33182: Enable dark mode in a easy way
-------------------------------------+-------------------------------------
Reporter: Matteo Vitali | Owner: RUDRANSH-
Type: | hub
Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: 3.2
Severity: Normal | Resolution:

Keywords: admin dark schema | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by RUDRANSH-hub):

* owner: nobody => RUDRANSH-hub
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/33182#comment:1>

Django

unread,
Oct 9, 2021, 1:07:11 PM10/9/21
to django-...@googlegroups.com
#33182: Enable dark mode in a easy way
-------------------------------------+-------------------------------------
Reporter: Matteo Vitali | Owner: Matteo
Type: | Vitali

Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: 3.2
Severity: Normal | Resolution:
Keywords: admin dark schema | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* owner: RUDRANSH-hub => Matteo Vitali


Comment:

Appreciate the interest, but we have a patch prepared already by the
ticket author. We should evaluate that one first.
[https://github.com/django/django/pull/14929 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/33182#comment:2>

Django

unread,
Oct 10, 2021, 5:13:19 AM10/10/21
to django-...@googlegroups.com
#33182: Enable dark mode in a easy way
-------------------------------------+-------------------------------------
Reporter: Matteo Vitali | Owner: Matteo
Type: | Vitali
Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: dev
Severity: Normal | Resolution:

Keywords: admin dark schema | Triage Stage:
css ui ux | Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Paolo Melchiorre):

* cc: Paolo Melchiorre (added)
* keywords: admin dark schema => admin dark schema css ui ux
* version: 3.2 => dev


Comment:

Great addition Matteo. I think the correct target version is current dev
and the pathc nedd some improvements like release note additions.

--
Ticket URL: <https://code.djangoproject.com/ticket/33182#comment:3>

Django

unread,
Oct 11, 2021, 12:10:35 AM10/11/21
to django-...@googlegroups.com
#33182: Enable dark mode in a easy way
-------------------------------------+-------------------------------------
Reporter: Matteo Vitali | Owner: Matteo
Type: | Vitali
Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: dev
Severity: Normal | Resolution:
Keywords: admin dark schema | Triage Stage: Accepted
css ui ux |
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1
* stage: Unreviewed => Accepted
* needs_tests: 0 => 1
* needs_docs: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/33182#comment:4>

Django

unread,
Oct 11, 2021, 12:10:57 AM10/11/21
to django-...@googlegroups.com
#33182: Enable dark mode in a easy way
-------------------------------------+-------------------------------------
Reporter: Matteo Vitali | Owner: Matteo
Type: | Vitali
Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: dev
Severity: Normal | Resolution:
Keywords: admin dark schema | Triage Stage: Accepted
css ui ux |
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* cc: Carlton Gibson (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/33182#comment:5>

Django

unread,
Oct 12, 2021, 7:12:23 AM10/12/21
to django-...@googlegroups.com
#33182: Enable dark mode in a easy way
-------------------------------------+-------------------------------------
Reporter: Matteo Vitali | Owner: Matteo
Type: | Vitali
Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: dev
Severity: Normal | Resolution:
Keywords: admin dark schema | Triage Stage: Accepted
css ui ux |
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

So this is a follow-up to #31259 which added the dark theme after #32018
allowed theming via CSS vars.

[https://stackoverflow.com/questions/67135053/can-someone-explain-to-my-
why-my-django-admin-theme-is-dark This Stack Overflow thread captures the
issues people have].

* How to disable (whilst keeping `prefers-color-scheme` set to dark?🤔)
* Where/how exactly to override.

The PR moves the dark theme variable definitions into their own file, and
adds an AdminSite attribute for that.

Probably just a `block` is enough.

Then in [https://docs.djangoproject.com/en/3.2/ref/contrib/admin/#admin-
theming the Theming Support] docs:

* Link `template override` in the first paragraph to the
[https://docs.djangoproject.com/en/3.2/ref/contrib/admin/#overriding-
admin-templates Overriding Admin Templates] docs.
* Move the "A dark theme..." paragraph to a new subsection below "The list
of CSS variables..."]
* Then add the file the vars are defined in, and mention the block that
can be overridden to replace these, or skip the stylesheet entirely.
* Add a `versionchanged` for the variables being move to a separate
stylesheet.

That should cover it.

I'm not sure we have automated tests for this. Manual testing will have to
do.

--
Ticket URL: <https://code.djangoproject.com/ticket/33182#comment:6>

Django

unread,
Oct 12, 2021, 7:15:57 AM10/12/21
to django-...@googlegroups.com
#33182: Improve control of Admin's dark mode CSS.

-------------------------------------+-------------------------------------
Reporter: Matteo Vitali | Owner: Matteo
Type: | Vitali
Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: dev
Severity: Normal | Resolution:
Keywords: admin dark schema | Triage Stage: Accepted
css ui ux |
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/33182#comment:7>

Django

unread,
Oct 27, 2021, 4:44:32 AM10/27/21
to django-...@googlegroups.com
#33182: Improve control of Admin's dark mode CSS.
-------------------------------------+-------------------------------------
Reporter: Matteo Vitali | Owner: Matteo
Type: | Vitali
Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: dev
Severity: Normal | Resolution:
Keywords: admin dark schema | Triage Stage: Ready for
css ui ux | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin
* needs_tests: 1 => 0
* needs_docs: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/33182#comment:8>

Django

unread,
Oct 27, 2021, 5:59:23 AM10/27/21
to django-...@googlegroups.com
#33182: Improve control of Admin's dark mode CSS.
-------------------------------------+-------------------------------------
Reporter: Matteo Vitali | Owner: Matteo
Type: | Vitali
Cleanup/optimization | Status: closed
Component: contrib.admin | Version: dev
Severity: Normal | Resolution: fixed

Keywords: admin dark schema | Triage Stage: Ready for
css ui ux | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson <carlton.gibson@…>):

In [changeset:"a754b82dac511475b6276039471ccd17cc64aeb8" a754b82d]:
{{{
#!CommitTicketReference repository=""
revision="a754b82dac511475b6276039471ccd17cc64aeb8"
Refs #33182 -- Adjusted custom admin theming example to use correct
template block.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33182#comment:10>

Django

unread,
Oct 27, 2021, 5:59:24 AM10/27/21
to django-...@googlegroups.com
#33182: Improve control of Admin's dark mode CSS.
-------------------------------------+-------------------------------------
Reporter: Matteo Vitali | Owner: Matteo
Type: | Vitali
Cleanup/optimization | Status: closed
Component: contrib.admin | Version: dev
Severity: Normal | Resolution: fixed
Keywords: admin dark schema | Triage Stage: Ready for
css ui ux | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson <carlton.gibson@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"3f1f8b93760eee2f26eb84ddc4054f0c6b319da5" 3f1f8b93]:
{{{
#!CommitTicketReference repository=""
revision="3f1f8b93760eee2f26eb84ddc4054f0c6b319da5"
Fixed #33182 -- Moved admin dark mode vars to separate stylesheet and
template block.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33182#comment:9>

Django

unread,
Oct 27, 2021, 6:18:04 AM10/27/21
to django-...@googlegroups.com
#33182: Improve control of Admin's dark mode CSS.
-------------------------------------+-------------------------------------
Reporter: Matteo Vitali | Owner: Matteo
Type: | Vitali
Cleanup/optimization | Status: closed
Component: contrib.admin | Version: dev
Severity: Normal | Resolution: fixed
Keywords: admin dark schema | Triage Stage: Ready for
css ui ux | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson <carlton.gibson@…>):

In [changeset:"afe090481f5ba04f1057cf598849f67d0bdf5d62" afe09048]:
{{{
#!CommitTicketReference repository=""
revision="afe090481f5ba04f1057cf598849f67d0bdf5d62"
[4.0.x] Refs #33182 -- Adjusted custom admin theming example to use
correct template block.

Backport of a754b82dac511475b6276039471ccd17cc64aeb8 from main
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33182#comment:11>

Django

unread,
Oct 27, 2021, 6:18:34 AM10/27/21
to django-...@googlegroups.com
#33182: Improve control of Admin's dark mode CSS.
-------------------------------------+-------------------------------------
Reporter: Matteo Vitali | Owner: Matteo
Type: | Vitali
Cleanup/optimization | Status: closed
Component: contrib.admin | Version: dev
Severity: Normal | Resolution: fixed
Keywords: admin dark schema | Triage Stage: Ready for
css ui ux | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson <carlton.gibson@…>):

In [changeset:"128179c0f8381b8fa0c9e630ce2e4a24665fb728" 128179c0]:
{{{
#!CommitTicketReference repository=""
revision="128179c0f8381b8fa0c9e630ce2e4a24665fb728"
[3.2.x] Refs #33182 -- Adjusted custom admin theming example to use
correct template block.

Backport of a754b82dac511475b6276039471ccd17cc64aeb8 from main
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33182#comment:12>

Reply all
Reply to author
Forward
0 new messages