I installed Django after couple of months. Current version is 3.2.4.
Earlier Django-admin was just light-mode. Current Django-admin switches automatically to dark or light according to system theme. Well, I do not want this behaviour. I want Django-admin to be light theme irrespective of system theme. I am Not using 3rd party theme for Django-admin.
As per one of the comment in this answer,
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.
I tried commenting the code as shown here but does not work. I tried clearing cache and even tried switching browser but none of them seems to work. In browsers, I always prefer light theme. How can I achieve this? Any help is appreciable. Thanks in advance :)
OS: Fedora 5.11.12-300.fc34.x86_64
Python-Verion: 3.9.5
1st way: The fastest way is to go to your OS Settings and change from your theme from Dark to Light. If you are using Linux, you might need gnome-tweaks
to switch between themes.
2nd way:
venv/Lib/site-packages/django/contrib/admin/static/admin/css/base.css
prefers-color-scheme: dark
. It would look something like this.@media (prefers-color-scheme: dark) {
:root {
/* code */
}
prefers-color-scheme: dark
from the following file
too: /static/admin/css/base.css
Note: Sometimes browser stores the CSS files in cache memory. To hard reload all the CSS files, hard reload the admin page using Ctrl + Shift + R.