In this blog we’ll see how to change the default Django admin panel colors. we have always seen Django admin with a standard greenish-blue color but we can customize Django admin theme and change its color because everything can be edited and customized which is one of the coolest parts of this great framework.
Let’s dive into how to do that, The main question here arises, why would someone wants to change the color scheme of the admin aside from the obvious reason that they like some other color better.
There are a couple of different ways of achieving that, but for now we will achieve this using third-party package.
Using A Package
There is this package available which we can use django-admin-interface to change the color of admin.
This provides enough customization for a regular user.
Read About Django Project vs App What is JQuery and Why to Use Best 5 Steps to build your own website
When using this approach:
- It is easy to Implement and change the color whenever we want dynamically without having to change the code.
- It can change solid colors. Gradients or other custom changes are not available.
- These changes of color are saved on the DB so on a fresh DB every time it comes with default colors.
Lets Do this
pip install django-admin-interface
Add admin_interface, flat_responsive, flat and colorfield to settings. INSTALLED_APPS
INSTALLED_APPS = [
'flat_responsive', # only if django version < 2.0
'flat', # only if django version < 1.9
X_FRAME_OPTIONS='SAMEORIGIN' # only if django version >= 3.0
python manage.py migrate python manage.py collectstatic
Restart your application server and now you should be able to see a new color scheme added by the package. If you want to customize it further go to your admin and look for “themes” app and do customizations there.
A couple of favorite customizations there apart from colors are:
- Use dropdown for your list_filter
- Add/Change Favicon and logo for admin
- Rounded corners for a slight step towards “modern” design
Comment down if you like it 👍.also Comment down if you have any queries.