Disabling dark / light mode UI toggle

170 views
Skip to first unread message

Niccolò Mineo

unread,
Aug 7, 2023, 5:26:11 PM8/7/23
to Django developers (Contributions to Django itself)
There is a specific situation in which I wouldn't want the user to be able to toggle between dark and light mode for the admin theme, and that is if I heavily customized it. I haven't found a way to disable that specific toggle, so I suggest that an AdminSite.ui_toggle (or the like) boolean be added. What do you think?

Niccolò Mineo

unread,
Aug 7, 2023, 5:28:30 PM8/7/23
to Django developers (Contributions to Django itself)
* I haven't found a convenient way, that is.

Adam Johnson

unread,
Aug 8, 2023, 1:33:12 AM8/8/23
to django-d...@googlegroups.com
You should be able to disable the button by creating an empty admin/color_theme_toggle.html template in your project.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/7f09013b-02db-40bf-928f-83a737dec069n%40googlegroups.com.

Niccolò Mineo

unread,
Aug 9, 2023, 11:46:34 AM8/9/23
to Django developers (Contributions to Django itself)
Yes, not pretty, though, right?

Carlton Gibson

unread,
Aug 9, 2023, 1:03:25 PM8/9/23
to django-d...@googlegroups.com
Quite likely not, but such a niche feature isn’t worth the extra API surface area, I’d likely think. 
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/47774b6a-a783-47cf-8229-299f891c1b32n%40googlegroups.com.

Niccolò Mineo

unread,
Aug 10, 2023, 5:53:55 AM8/10/23
to Django developers (Contributions to Django itself)
Django currently allows removing the view site link, which I'd call a niche feature. Considering also the recent theming improvements in Django, allowing to hide the color theme toggle shouldn't be more niche than said view site link removal feature.

Il giorno mercoledì 9 agosto 2023 alle 19:03:25 UTC+2 Carlton Gibson ha scritto:
Quite likely not, but such a niche feature isn’t worth the extra API surface area, I’d likely think. 

On Wednesday, 9 August 2023, Niccolò Mineo <niccol...@gmail.com> wrote:
Yes, not pretty, though, right?

Il giorno martedì 8 agosto 2023 alle 07:33:12 UTC+2 Adam Johnson ha scritto:
You should be able to disable the button by creating an empty admin/color_theme_toggle.html template in your project.

On Mon, Aug 7, 2023 at 10:28 PM Niccolò Mineo <niccol...@gmail.com> wrote:
* I haven't found a convenient way, that is.

Il giorno lunedì 7 agosto 2023 alle 23:26:11 UTC+2 Niccolò Mineo ha scritto:
There is a specific situation in which I wouldn't want the user to be able to toggle between dark and light mode for the admin theme, and that is if I heavily customized it. I haven't found a way to disable that specific toggle, so I suggest that an AdminSite.ui_toggle (or the like) boolean be added. What do you think?

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/7f09013b-02db-40bf-928f-83a737dec069n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.

Adam Johnson

unread,
Aug 10, 2023, 7:03:18 AM8/10/23
to django-d...@googlegroups.com
IMO that’s not an argument for bloating the interface further. If we could go back in time perhaps we’d not make many of the same decisions.

I’d say the way forwards is to write a blog post documenting this template override technique, and if there are signs that others find it useful, we could add a docs note.

Reply all
Reply to author
Forward
0 new messages