Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ericpugh/dub-color
Find the english language name of a (HEX) color
https://github.com/ericpugh/dub-color
color-palette php
Last synced: about 2 months ago
JSON representation
Find the english language name of a (HEX) color
- Host: GitHub
- URL: https://github.com/ericpugh/dub-color
- Owner: ericpugh
- Created: 2016-12-28T15:27:22.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-10T19:58:54.000Z (almost 8 years ago)
- Last Synced: 2024-07-17T13:20:58.655Z (6 months ago)
- Topics: color-palette, php
- Language: PHP
- Homepage:
- Size: 21.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DubColor
Find the english language name of a (HEX) color. Names provided by one of the following color palettes, or can be extended to use a custom palette:
* [Crayola](https://www.wikiwand.com/en/List_of_Crayola_crayon_colors)
* [CSS3](https://drafts.csswg.org/css-color-3/)
* [CSS4](https://drafts.csswg.org/css-color/)
* [NCS](https://en.wikipedia.org/wiki/Natural_Color_System)### Example Usage
```php
countColorPalette();// An example hex color.
$example_hex = '#83F600';
$example_color = new Color($dubber::fromHexToInt($example_hex));
// Finds the closest HEX color in the current palette.
$closest = $dubber->closestColor($example_color);
// Finds the name "lawngreen".
$name = $dubber->getColorName($closest);// Output results.
$label = sprintf('Found 1 in %d colors', $total_num_colors);
$color_span = sprintf('Name: %s', $closest, $name);
echo $label . $color_span;?>
```