foyyay/colorcast
Composer 安装命令:
composer create-project foyyay/colorcast
包简介
Get tints and shades based on configuration data and a color hue.
README 文档
README
Given a configuration of hue points to named saturation and value entries you can provide a hue and the saturation and value will be interpolated and the resulting color returned as a hex string.
Install
composer require foyyay/colorcast;
Use
use Foyyay\ColorCast\ColorCast;
$caster = new ColorCast(config);
$colors = $caster->fromHue(90);
// or
$colors = $caster->fromColor('#87d936');
An example config could look like:
$config = [ "0" => [ "primary" => ["saturation" => 80, "value" => 70], "accent" => ["saturation" => 75, "value" => 85], ], "20" => [ "primary" => ["saturation" => 40, "value" => 50], "accent" => ["saturation" => 80, "value" => 90], ], ];
So given a hue of 90 the you'll get back an array with two keys, "primary", and "accent". The hue for both colors will be 90, the saturation for primary will be 60 and the value will be 60.
You may add as many hue values from 0 to < 360 as you want. You can add as many named configs as you want.
Thank you.
Bootstrapped using the Composer Library Template.
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-09-04