bitandblack / color-hash
Generates a color based on a given string.
Fund package maintenance!
Buymeacoffee
Requires
- php: >=8.2
- ext-mbstring: *
- bitandblack/colors: ^2.7
Requires (Dev)
- phpstan/phpstan: ^1.0
- phpunit/phpunit: ^11.0
- rector/rector: ^1.0
- symplify/easy-coding-standard: ^12.0
README
Bit&Black Color Hash
Generates a color based on a given string.
This library is based on shahonseven/php-color-hash which is a PHP port of ColorHash Javascript Library, but adds a lot more functions.
Installation
This library is made for the use with Composer. Add it to your project by running $ composer require bitandblack/color-hash
.
Usage
<?php
use BitAndBlack\ColorHash\ColorHash;
$colorHash = new ColorHash('Hello World');
You can access the color values then in an array by calling $colorHash->getValues()
or echo the whole object.
This library used bitandblack/colors, so you can get the color information in many different color spaces. To get it for example in CMYK write $colorHash->getCMYK()
. There are HEX, RGB, CIALab and many more available.
Help
If you have any questions, feel free to contact us under hello@bitandblack.com
.
Further information about Bit&Black can be found under www.bitandblack.com.