CSS-only icon system for Django
Project description
django-iconx
CSS-only icon system for Django.
Generates a single CSS file from SVG icon sources (Lucide, Heroicons, or your own). No JavaScript, no icon fonts.
<i class="icon icon-search"></i>
<span class="icon icon-check text-2xl text-green-500"></span>
<!-- aria-hidden="true" hides decorative icons from screen readers -->
<i class="icon icon-search" aria-hidden="true"></i>
How it works and what the upsides are
Mono icons use mask-image with background-color: currentColor, so the SVG acts as a mask and the icon inherits text color. Multi-color icons use background-image to preserve original SVG colors.
The output is plain CSS classes: no runtime, no bundler plugin, no framework coupling. The approach is not Django-specific; Django is just a good fit because its static file conventions make wiring it up easy. Any stack that serves CSS and renders HTML can use the generated stylesheet directly.
.icon { display: inline-block; width: 1em; height: 1em; }
.icon-search, .icon-check { background-color: currentColor; mask-size: contain; mask-mode: alpha; }
.icon-search { mask-image: url("/static/icons/search.svg"); }
.icon-logo { background-image: url("/static/logos/logo.svg"); }
currentColor+mask-image: icons inherit text color1emsizing: icons scale with font size / Tailwindtext-*- Direct element styling, no
::beforepseudo-element - Tree-shakeable: PurgeCSS strips unused
.icon-*rules
Browser support
CSS mask-image is supported unprefixed in all modern browsers since Dec 2023 (~97% global coverage). Tailwind v4 handles vendor prefixing automatically:
@import "tailwindcss";
@import "./static/iconx/icons.css";
Installation
uv add django-iconx
Full documentation at oliverhaas.github.io/django-iconx
License
MIT
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_iconx-0.1.0.tar.gz.
File metadata
- Download URL: django_iconx-0.1.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc83f44cdc22502405e6be453ff282e69c9d418656bb76dc11ad280a76a27d32
|
|
| MD5 |
260a7de8da8102d0a4cea0be3e8e4e13
|
|
| BLAKE2b-256 |
bb23a93661a4120bd1488aebc0ae4422e8c505afe03f9e132948e6b97526dc9a
|
Provenance
The following attestation bundles were made for django_iconx-0.1.0.tar.gz:
Publisher:
publish.yml on oliverhaas/django-iconx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_iconx-0.1.0.tar.gz -
Subject digest:
cc83f44cdc22502405e6be453ff282e69c9d418656bb76dc11ad280a76a27d32 - Sigstore transparency entry: 1247662337
- Sigstore integration time:
-
Permalink:
oliverhaas/django-iconx@afbadd0dcad627915d31c497540316e8102a18ed -
Branch / Tag:
refs/heads/main - Owner: https://github.com/oliverhaas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@afbadd0dcad627915d31c497540316e8102a18ed -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file django_iconx-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_iconx-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af4da5ef6fbc220530481bd2fe421910ae5f66db174618e73f518650324b4f3a
|
|
| MD5 |
dad68008aa2a71f70569ca9db6b508ec
|
|
| BLAKE2b-256 |
e2705e25c6265302a950e9aa148b4186ece5de868a90cf940f6d916c961c0c4e
|
Provenance
The following attestation bundles were made for django_iconx-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on oliverhaas/django-iconx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_iconx-0.1.0-py3-none-any.whl -
Subject digest:
af4da5ef6fbc220530481bd2fe421910ae5f66db174618e73f518650324b4f3a - Sigstore transparency entry: 1247662346
- Sigstore integration time:
-
Permalink:
oliverhaas/django-iconx@afbadd0dcad627915d31c497540316e8102a18ed -
Branch / Tag:
refs/heads/main - Owner: https://github.com/oliverhaas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@afbadd0dcad627915d31c497540316e8102a18ed -
Trigger Event:
workflow_dispatch
-
Statement type: