Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rgson/python-colornames
A Python library for finding the names of colors.
https://github.com/rgson/python-colornames
color library python
Last synced: about 1 month ago
JSON representation
A Python library for finding the names of colors.
- Host: GitHub
- URL: https://github.com/rgson/python-colornames
- Owner: rgson
- License: mit
- Created: 2017-04-22T22:51:00.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-06-29T17:24:07.000Z (7 months ago)
- Last Synced: 2024-11-25T17:46:30.218Z (about 2 months ago)
- Topics: color, library, python
- Language: Python
- Size: 58.6 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
## Installation
PyPI: [pycolornames](https://pypi.org/project/pycolornames/)
```sh
pip install pycolornames
```## Usage
A single function, `find`, is exposed by the library. It finds the name of a given color.
```python
>>> 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)).## Acknowledgements
The list of color names is based on Chirag Mehta's [ntc js](http://chir.ag/projects/ntc), licensed under [CC BY 2.5](https://creativecommons.org/licenses/by/2.5/).