A Django app to provide dark mode static files for the Django Admin.
Project description
django-dark
Preamble
This is just a fresh playground, stay tuned or feel free to contribute.
Setup
pip install django-dark
Integration
-
Add "dark" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ... 'dark', ]
-
Modify Django's base_site.html
{% block extrahead %} . . <link href="/static/admin/css/dark.css" type="text/css" media="(prefers-color-scheme: dark)" rel="stylesheet"> {% endblock %}
Template can be found here:
- lib/python3.X/site-packages/django/contrib/admin/templates/admin/base_site.html
- https://github.com/django/django/blob/master/django/contrib/admin/templates/admin/base_site.html
-
Helper Classes
If you are using tintable images (one colored icons), you can add the class "img-invertable", which simply represents:
.img-invertable { filter: invert(0.7) }
Current Result
Developer Notes
# alias sv="source .virtualenv/bin/activate"
# alias vv="mkdir .virtualenv && python3 -m venv .virtualenv && sv"
vv
sv
pip install -r requirements/common.txt
# Compile Examples
lesscpy -x dark/less/dark.less dark/static/admin/css/dark.css
watchmedo shell-command --wait --patterns="*.less" --recursive --command "lesscpy -V -x dark/less/dark.less dark/static/admin/css/dark.css"
watchmedo shell-command --wait --patterns="*.less" --recursive --command "lesscpy -V -x dark/less/dark.less dark/static/admin/css/dark.css && python manage.py collectstatic --noinput"
# Distribution
python setup.py sdist
twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-dark-0.1.9.tar.gz
(6.7 kB
view details)
File details
Details for the file django-dark-0.1.9.tar.gz
.
File metadata
- Download URL: django-dark-0.1.9.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
e7209f3606c6df0338211f8d2a01b5858d6f9984795f63cbe38fc02bd959ed37
|
|
MD5 |
79f042fb5fdc9b8b5b4597222fe9c6fc
|
|
BLAKE2b-256 |
11c99cfdc2c125f9936902c11e539522f3fcaac1a6faeb7f31b9be888a084f12
|