Skip to content

Given a description of a color, return its closest standard HTML4 color.

License

Notifications You must be signed in to change notification settings

nelson-liu/word2color

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Word2Color

About

Word2Color converts natural language color descriptions to standard HTML4 colors. This is especially useful in data science, where color attributes often do not follow any normal list -- this enables users to quickly add various colors to simplifying bins of HTML4 standard colors. It does this by an input query (say "blue cream"), scraping the first X results from bing images (X is a parameter you can specify) for your query, and using K-Means Clustering to find the dominant color in each image, which is then averaged with the other images scraped and converted to the closest HTML4 color.

Installation

Word2Color is only tested on Python 2.7.X, although it likely works on Python 3 as well. OpenCV 2.4.X is a dependency, but is not listed in the requirements.txt to maintain compatability with virtual environments (See: How to install OpenCV in virtualenv). To install with pip, run:

pip install word2color

Note that after installng with pip, you should ensure you have all the requirements in the requirements.txt.

Example Usage

>>> from word2color import word2color
>>> word2color.color_description_to_bin('blue cream')
'silver'

Contributing

Pull requests are welcome!

License

Word2Color is licensed under the MIT License.

Copyright (c) 2016-2016 Nelson Liu and Aakash Sethi

About

Given a description of a color, return its closest standard HTML4 color.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages