Search code examples
djangogoogle-chromedjango-adminckeditordarkmode

Disable prefers-color-scheme: dark in django admin


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.

enter image description here


Solution

  • 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).