michimani/text-to-color
Composer 安装命令:
composer require michimani/text-to-color
包简介
text-to-color is a simple php class for generating color code from text.
README 文档
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
统计信息
- 总下载量: 19
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-07-20