diff options
| author | Matthias Kestenholz <mk@feinheit.ch> | 2021-01-07 10:07:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-07 10:07:19 +0100 |
| commit | 0a802233ec1421e5e59a486be69daef9b112fd0d (patch) | |
| tree | 51446f08155caa22365fa2ee3ad34510eb5787ea /docs | |
| parent | 102d92fc09849e1a9004dd3f9a14a0ea9ca392cd (diff) | |
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.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/contrib/admin/index.txt | 28 | ||||
| -rw-r--r-- | docs/releases/3.2.txt | 2 | ||||
| -rw-r--r-- | docs/spelling_wordlist | 1 |
3 files changed, 31 insertions, 0 deletions
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 }} + <style> + :root { + --primary: #9774d5; + --secondary: #785cab; + --link-fg: #7c449b; + --link-selected-fg: #8f5bb2; + } + </style> + {% 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 |
