mischiefcollective/colorjizz
Composer 安装命令:
composer require mischiefcollective/colorjizz
包简介
Classes for manipulating colors, converting to different formats and finding color harmonies
README 文档
README
Getting started:
ColorJizz-PHP uses the PSR-0 standards for namespaces, so there should be no trouble using with frameworks like Symfony 2.
Autoloading
An autoloader class is provided for when loading ColorJizz yourself.
First, include the autoloader and call the static register() function.
<?php require_once 'path/to/colorjizz/lib/MischiefCollective/ColorJizz/Autoloader.php'; MischiefCollective\ColorJizz\Autoloader::register(); ?>
Now all ColorJizz classes will be automatically loaded in.
Converting between formats
ColorJizz can convert to and from any of the supported color formats:
<?php use MischiefCollective\ColorJizz\Formats\Hex; $red_hex = new Hex(0xFF0000); $red_cmyk = $hex->toCMYK(); echo get_class($red_cmyk); // MischiefCollective\ColorJizz\Formats\CMYK echo $red_cmyk; // 0,1,1,0 ?>
Any color manipulation or conversion will return a new instance of a color class, therefore your original color objects remains intact.
Color manipulation can be chained together:
<?php use MischiefCollective\ColorJizz\Formats\Hex; echo Hex::fromString('red')->hue(-20)->greyscale(); // 555555 ?>
Any color manipulation will always return the color in the same format unless you're specifically converting the format. For example:
<?php use MischiefCollective\ColorJizz\Formats\RGB; $red = new RGB(255, 0, 0); echo get_class($red->hue(-20)->saturation(2)); // MischiefCollective\ColorJizz\Formats\RGB ?>
Supported formats:
<?php new RGB(r, g, b); new CMY(c, m, y); new CMYK(c, m, y, k); new Hex(0x000000); new HSV(h, s, v); new CIELab(l, a, b); new CIELCh(l, c, h); new XYZ(x, y, z); new Yxy(Y, x, y);
Conversion functions:
<?php ->toRGB(); ->toCMY(); ->toCMYK(); ->toHex(); ->toHSV(); ->toCIELab(); ->toCIELCh(); ->toXYZ(); ->toYxy();
mischiefcollective/colorjizz 适用场景与选型建议
mischiefcollective/colorjizz 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 864.06k 次下载、GitHub Stars 达 285, 最近一次更新时间为 2012 年 10 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mischiefcollective/colorjizz 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mischiefcollective/colorjizz 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 864.06k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 286
- 点击次数: 20
- 依赖项目数: 8
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2012-10-08