Skip to main content
https://travis-ci.org/ubernostrum/webcolors.svg?branch=master

webcolors is a Python (2.7, 3.5+) module for working with HTML/CSS color definitions.

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:

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

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

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

Full documentation is available online.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

webcolors-1.9.tar.gz (35.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

webcolors-1.9-py2.py3-none-any.whl (10.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file webcolors-1.9.tar.gz.

File metadata

  • Download URL: webcolors-1.9.tar.gz
  • Upload date:
  • Size: 35.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.1

File hashes

Hashes for webcolors-1.9.tar.gz
Algorithm Hash digest
SHA256 ad54b6c1e524a492506232b7cea757367a5535e22db09e998e7b056a16b198bc
MD5 d902346085645b717810f37d4faaeda3
BLAKE2b-256 c3acf09dba195203627a626ee298f8649e5705d3f7f3b89ef09f524b9aa50443

See more details on using hashes here.

File details

Details for the file webcolors-1.9-py2.py3-none-any.whl.

File metadata

  • Download URL: webcolors-1.9-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.1

File hashes

Hashes for webcolors-1.9-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 49f887d15e86cee92f3c5a716de23012fe769540fc02e3d2dbc57dc707a0dbfd
MD5 f83ca2d1752faf189b8e92dcbe3f08eb
BLAKE2b-256 7989d39bfded8cea46b3339200f793af3e1c41b6011332af7048eef93b988ef1

See more details on using hashes here.

Release history Release notifications | RSS feed

25.10.0

2 files

24.11.1

2 files

24.11.0

2 files

24.8.0

2 files

24.6.0

2 files

1.13

2 files

1.12

2 files

1.11.1

2 files

1.11

2 files

1.10

2 files

1.9.1

2 files

This release

1.9 This release

2 files

1.8.1

2 files

1.8

1 file

1.7

1 file

1.5

1 file

1.4

1 file

1.3.1

1 file

1.3

1 file

1.2

1 file

1.1

1 file

1.0

1 file

0.1

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