From 0a802233ec1421e5e59a486be69daef9b112fd0d Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Thu, 7 Jan 2021 10:07:19 +0100 Subject: Fixed #32018 -- Extracted admin colors into CSS variables. Defined all colors used in the admin CSS as variables. Implemented the following standardizations and accessibility improvements while at it: - Improved the contrast of text to not use ratios of less than 3:1 anymore. - Most hover states already used desaturated and darkened colors. Changed object tools to follow the same rule instead of showing the primary color on hover. Various places used similar colors; those have been merged with the goal of reducing the count of CSS variables. Contrasts have been improved in a few places. - Many borders used slightly different colors (e.g. #eaeaea vs. #eee) - Help texts used #999, this has been changed to --body-quiet-color (#666) which has a better contrast. Introduced fast color transitions on links and buttons. --- docs/ref/contrib/admin/index.txt | 28 ++++++++++++++++++++++++++++ docs/releases/3.2.txt | 2 ++ docs/spelling_wordlist | 1 + 3 files changed, 31 insertions(+) (limited to 'docs') diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 29af4cbcba..87d1b4f3f5 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -2802,6 +2802,34 @@ creating your own ``AdminSite`` instance (see below), and changing the :attr:`AdminSite.index_template` , :attr:`AdminSite.login_template` or :attr:`AdminSite.logout_template` properties. +.. _admin-theming: + +Theming support +=============== + +The admin uses CSS variables to define colors. This allows changing colors +without having to override many individual CSS rules. For example, if you +preferred purple instead of blue you could add a ``admin/base.html`` template +override to your project: + +.. code-block:: html+django + + {% extends 'admin/base.html' %} + + {% block extrahead %}{{ block.super }} + + {% endblock %} + +An up-to-date list of CSS variables is at +:file:`django/contrib/admin/static/admin/css/base.css`. + ``AdminSite`` objects ===================== diff --git a/docs/releases/3.2.txt b/docs/releases/3.2.txt index 71c5ec09ef..6850774312 100644 --- a/docs/releases/3.2.txt +++ b/docs/releases/3.2.txt @@ -117,6 +117,8 @@ Minor features * Read-only related fields are now rendered as navigable links if target models are registered in the admin. +* The admin now supports theming. See :ref:`admin-theming` for more details. + :mod:`django.contrib.admindocs` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/spelling_wordlist b/docs/spelling_wordlist index 74a1c30c0c..4ccf34ca4d 100644 --- a/docs/spelling_wordlist +++ b/docs/spelling_wordlist @@ -676,6 +676,7 @@ textarea th that'll Thejaswi +theming This'll threadlocals threadpool -- cgit v1.3