Skip to main content

Finds the name of any color.

Project description

python-colornames

A Python library for finding the names of colors.

The colornames library gives you the name of any RGB color. If the exact color you're looking for doesn't have a name, it'll find the closest match instead.

Usage

A single function, find, is exposed by the library. It finds the name of a given color.

>>> import colornames
>>> colornames.find(255, 255, 255)   # Decimal RGB
'White'
>>> colornames.find('#3e3e3e')       # Hexadecimal notation
'Dune'
>>> colornames.find('#abc')          # Shorthand hexadecimal
'Cadet Blue'
>>> colornames.find('f5f5f5')        # Optional '#' prefix
'Wild Sand'
>>> colornames.find((123, 12, 1))    # Decimal RGB as a tuple
'Dark Burgundy'

License

The code is licensed under the MIT license. Certain parts are licensed under CC BY 2.5 (see acknowledgements).

Acknowledgements

The list of color names is based on Chirag Mehta's ntc js, licensed under CC BY 2.5.

Project details


Download files

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

Source Distribution

pycolornames-1.1.0.tar.gz (58.2 kB view hashes)

Uploaded Source

Built Distribution

pycolornames-1.1.0-py3-none-any.whl (36.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page