Customizing (Colors) Django Admin Panel

django color

Table of Contents

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.

django-admin-interface.gif

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:

  1. It is easy to Implement and change the color whenever we want dynamically without having to change the code.
  2. It can change solid colors. Gradients or other custom changes are not available.
  3. These changes of color are saved on the DB so on a fresh DB every time it comes with default colors.

Lets Do this

#install package
pip install django-admin-interface

Add admin_interface, flat_responsive, flat and colorfield to settings. INSTALLED_APPS
before django.contrib.admin

INSTALLED_APPS = [ 
#... 
'admin_interface', 
'flat_responsive', # only if django version < 2.0 
'flat', # only if django version < 1.9 
'colorfield', 
'django.contrib.admin', 
#... ] 
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.

http://localhost:8000/admin/admin_interface/theme/

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.

3 thoughts on “Customizing (Colors) Django Admin Panel”

  1. Pingback: Custom User Model In Django | Uncategorized Vision Secrets

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
Vision Secrets