I have dark mode enabled on Mac, but it looks awkward in django admin panel with ckeditor. Is it any option to disable it in Chrome or Django admin? I have already tried themes and browser extensions with no success.
-
https://docs.djangoproject.com/en/3.2/ref/contrib/admin/ you can refer to the Django documentation and override the dark theme due to the your system settings (prefers-color-scheme) – card_master May 09 '21 at 10:41
4 Answers
It looks like you're using some 3rd party theme for Django admin. I suggest checking if the maintainer of this theme wants to support Django 3.2 any time soon.
As for the quick fix for that, you can introduce your own stylesheet that will reset variables responsible for the dark theme. You can find the variables here.
To achieve that, create a separate css file in your static file directory, copy over the @media
declaration from the code fragment mentioned above and paste the normal color scheme inside it (also to be found in the same code fragment). After that, create a admin/base_site.html
template, fill it with this content or the equivalent from the theme you're using and link your custom CSS in the extrastyle
block (you may need to create that block by hand).

- 20,081
- 5
- 46
- 77
-
3There is a fresh new Django project. After installation admin panel was already dark. I decided to comment "@media (prefers-color-scheme: dark)" section in /static/admin/css/base.css . Not sure that it's good solution but the fastest one. – VictoriaSh Apr 23 '21 at 10:36
-
1I see you're using some wysiwyg editor and that's what is causing the troubles. Look for the new release of it to see if it supports dark color scheme. If not, see the issues list for this support and preferably report an issue if it doesn't exist yet. – GwynBleidD May 10 '21 at 13:24
-
1
-
3@ajinzrathod I've just commented `@media (prefers-color-scheme: dark) {}` section in admin/css/base.css. That's the easiest way. – VictoriaSh Jun 29 '21 at 11:51
-
1I can confirm that disabling the entirety of `django/contrib/admin/static/admin/css/base.css` works. It'll disable the dark mode in Django's Admin, as of v 4.0. – xax Jan 30 '22 at 06:02
There's an app for that.
pip install django-light
, details at https://github.com/frnhr/django-light.
Full disclosure: I'm the author. Well, more like "packager", not much original code there...

- 12,354
- 9
- 63
- 90
as @GwynBleidD wrote, I changed my admin/base_site.html
like this, and it works:
{% extends "admin/base_site.html" %}
{% block extrastyle %}
<style>
@media (prefers-color-scheme: dark) {
:root {
--primary: #79aec8;
--primary-fg: #fff;
--body-fg: #333;
--body-bg: #fff;
--body-quiet-color: #666;
--body-loud-color: #000;
--breadcrumbs-fg: #c4dce8;
--breadcrumbs-bg: var(--primary);
--link-fg: #447e9b;
--link-hover-color: #036;
--link-selected-fg: #5b80b2;
--hairline-color: #e8e8e8;
--border-color: #ccc;
--error-fg: #ba2121;
--message-success-bg: #dfd;
--message-warning-bg: #ffc;
--message-error-bg: #ffefef;
--darkened-bg: #f8f8f8; /* A bit darker than --body-bg */
--selected-bg: #e4e4e4; /* E.g. selected table cells */
--selected-row: #ffc;
--close-button-bg: #888; /* Previously #bbb, contrast 1.92 */
--close-button-hover-bg: #747474;
}
}
</style>
{% endblock %}

- 71
- 1
- 2
You can disable dark mode in Django 4.1 and above by overriding admin/base.html
in your template. https://github.com/django/django/pull/14929
{% extends "admin/base.html" %}
{% block dark-mode-vars %}{% endblock %}

- 5,422
- 4
- 25
- 38

- 270
- 2
- 17