michimani / text-to-color
text-to-color is a simple php class for generating color code from text.
Installs: 19
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/michimani/text-to-color
Requires
- php: >= 5.6.0
This package is not auto-updated.
Last update: 2025-12-21 11:38:25 UTC
README
Generate color code from a string.
How to use
- install using composer
composer require michimani/text-to-color
and require the main file.
require_once('./txt2color.php');
- create the object.
$t2c = new TextToColor();
- call
generateColorHexFromStringfunction.
$str = 'some string'; $color = $t2c->generateColorHexFromString($str); echo $color; // #10b51f
Customize
If you want to change algorithm for generating color code, set some string to $rand_str in TextToColor class.
- private $rand_str = 'some strings'; + private $rand_str = 'other strings';
$str = 'some string'; $color = $t2c->generateColorHexFromString($str); echo $color; // #0cf465