freshbrewedweb / colored-words
PHP utility to convert colors to their closest CSS color name.
dev-master
2017-05-26 18:58 UTC
Requires
- php: >=5.6
This package is auto-updated.
Last update: 2024-12-21 20:52:24 UTC
README
PHP utility to convert colors to their closest CSS color name.
Usage
$word = "Blue-pastel"; $color = new ColoredWords( $word ); echo $color->convert()->name();
Results in lightblue
Demo
API
get
gets the resulting matches.exactMatch
matches exact names.match
loosely matches names.sortByRelevance
adds a score to matches and sorts the array.convert
sets the best match by relevance.name
gets the converted name;hex
gets the hex code of the converted name.