webcolors
A library for working with the color formats defined by HTML and CSS.
Decision gist · record as of 2026-08-14
Yes. webcolors is stable, actively maintained, has zero known vulnerabilities, and solves a real problem with no external dependencies. Install it if you need to work with HTML/CSS color formats in any form—the low friction and permissive license make it a straightforward addition to any project.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Low friction: pure Python wheel with no runtime dependencies.
- Active maintenance with recent commits and a long release history since 2008.
License · maintenance · safety
BSD-3-Clause (permissive) — BSD-3-Clause permissive license allows commercial and private use with minimal restrictions.
last release 2025-10-31 (287 days) · last repo commit 2026-03-08 · 175 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 51,653,224 downloads/mo, #569 on PyPI
Alternatives
Verify before relying
pip install webcolors
import webcolors
webcolors.hex_to_name("#daa520") # Returns 'goldenrod'
webcolors.html5_parse_legacy_color("chucknorris") # Returns HTML5SimpleColor(red=192, green=0, blue=0)What it is and what it does
webcolors is a lightweight library for parsing, converting, and normalizing color values in the formats used by HTML and CSS. It handles specification-defined color names, hexadecimal notation (both six- and three-digit), integer and percentage RGB triplets, and implements the HTML5 color parsing and serialization algorithms. The package is pure Python with no external dependencies, making it quick to install and integrate into any project that needs to work with web color formats.
The library is useful when you need to accept color input in multiple formats and convert between them, validate color strings, or normalize color representations for storage or display. It covers the RGB colorspace; HSL conversion can be handled separately using Python's standard library colorsys module.
Use it for
- Convert hex color codes to human-readable CSS color names for UI display or logging.
- Parse HTML5 legacy color strings (including malformed input like 'chucknorris') into standardized RGB triplets.
- Normalize user-supplied color input from web forms into a canonical format for storage or validation.
- Build color pickers or theme editors that accept multiple color format inputs and need consistent internal representation.
- Validate that a color string matches a known HTML/CSS color name or format before using it in a stylesheet.
- Convert between RGB triplet formats (integer vs. percentage) for compatibility with different CSS contexts.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
webcolors is stable, actively maintained, has zero known vulnerabilities, and solves a real problem with no external dependencies. Install it if you need to work with HTML/CSS color formats in any form—the low friction and permissive license make it a straightforward addition to any project.
Install
webcolors on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Active maintenance with recent commits and a long release history since 2008.
Requires Python 3.10 or later.
License in practice
BSD-3-Clause permissive license allows commercial and private use with minimal restrictions.
Quickstart
pip install webcolors
import webcolors
webcolors.hex_to_name("#daa520") # Returns 'goldenrod'
webcolors.html5_parse_legacy_color("chucknorris") # Returns HTML5SimpleColor(red=192, green=0, blue=0)
Package facts
| License | BSD-3-Clause permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 287 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 51,653,224 / month, #569 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Utilities |
Evidence: webcolors-25.10.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “html css color conversion”
- webcolorsConverts and normalizes HTML and CSS color formats—hex, RGB triplets,…
- coloraideColorAide is a pure Python library for creating, converting, and…
- colourConverts between and manipulates color representations including RGB,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also colour · coloraide · colorlover · colorhash · hexor · colourmap · css-inline · ansicolors · colorful · colored