Skip to main content

🎨 Color Swatch Plugin for MkDocs

A lightweight plugin that lets you insert inline color swatches into your Markdown docs using a simple, readable syntax.

GitHub Release GitHub Issues GitHub Pull Requests License

PyPI Version Python Versions

Quality Gate Status Security Rating Reliability Rating Maintainability Rating Vulnerabilities Technical Debt

⭐ Features

  • Styled swatches with smooth hover animations and tooltips
  • Responsive swatches for all screen sizes
  • Supports various color formats:
    • Hex colors - #ff0000/#f00
    • RGB colors - rgb(255, 0, 0)
    • RGBA colors - rgba(255, 0, 0, 0.5)
  • No CSS setup required — styles are embedded automatically

Visit demo: https://fabieu.github.io/mkdocs-color-swatch-plugin/


🚀 Installation

Prerequisites

Install the plugin from PyPI using pip:

pip install mkdocs-color-swatch-plugin

Then enable it in your mkdocs.yml:

plugins:
  - color-swatch

Make sure you have mkdocs installed:

pip install mkdocs

✍️ Syntax & Usage

To add swatches to your Markdown, use the simple, custom inline format:

:color[#e74c3c]: -> Red
:color[rgb(52, 152, 219)]: -> Green
:color[rgba(46, 204, 113, 0.6)]: -> Blue

Each tag will render as:

  • A visual color preview
  • Dynamically generated tooltips showing the color value and label
  • A smooth hover animation for swatch elements

🧠 Why Use This Plugin?

Instead of manually writing HTML for every color sample like:

<span style="background-color: #e74c3c; width: 30px; height: 30px; ..."></span>

You can just write:

:color[#e74c3c]:  

It's faster, cleaner, and scales dynamically with your content.


💡 Features & Benefits

  • 🎨 Works with all valid hex, rgb(), and rgba() color values
  • 🎯 Simple syntax for embedding colors directly in your Markdown files
  • 🛠 Automatically injected CSS for responsive and visually appealing swatches
  • 🔄 Perfectly safe to use with other Markdown extensions
  • 🔍 Live color preview in rendered HTML files, complete with tooltips

🛠 Development & Contribution

👨‍💻 Repository Setup:

Clone the project repository and configure the environment with Poetry:

git clone https://github.com/yourusername/mkdocs-color-swatch-plugin.git
cd mkdocs-color-swatch-plugin
poetry install

Editable Install (for local use):

poetry install
pip install -e .

This allows you to test your changes directly when running MkDocs locally.


📄 License

MIT © Fabian Eulitz


📎 Resources

Metadata

Release files for mkdocs-color-swatch-plugin 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mkdocs-color-swatch-plugin 0.3.1
File Size Uploaded
mkdocs_color_swatch_plugin-0.3.1.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mkdocs-color-swatch-plugin 0.3.1
File Interpreter ABI Platform
mkdocs_color_swatch_plugin-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.0 kB

Release files / mkdocs_color_swatch_plugin-0.3.1.tar.gz

Download URL mkdocs_color_swatch_plugin-0.3.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1e01802a40bb397bd51affba928c357112a2637d0c4f783af08c809522c862db
BLAKE2b-256 checksum
How to use checksums
212a158352863e4f5f4f4ee31c5795d4ed0dea480d8193cb988ceb5e1f9e7474
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.

Transparency log

Release files / mkdocs_color_swatch_plugin-0.3.1-py3-none-any.whl

Download URL mkdocs_color_swatch_plugin-0.3.1-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
155f10b15b2484ef4b8910288683f93799d0a39c70ecbbba3fb0b3e5c963b876
BLAKE2b-256 checksum
How to use checksums
47b1697c8a25708f74d411f6581b48d92a75fced43ad9ed091c75600a826879b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page