dragon-code/which-color
最新稳定版本:4.1.0
Composer 安装命令:
composer require dragon-code/which-color
包简介
A simple helper, helping to determine what color the text will look better over a monotonous color.
README 文档
README
A simple helper, helping to determine what color the text will look better over a monotonous color.
Installation
To get the latest version of package, simply require the project using Composer:
composer require dragon-code/which-color
Instead, you may of course manually update your require section and run composer update if you so choose:
{
"require": {
"dragon-code/which-color": "^4.0"
}
}
Using
The package helps to determine what color it is better to write text over a monotonous color.
use DragonCode\WhichColor\Facades\Color; return Color::of('#000000')->lightIsBetter(); // returned `true`. A white text color is better for black background. return Color::of('#ffffff')->darkIsBetter(); // returned `true`. A black text color is better for white background. return Color::of('#ffffff')->lightIsBetter(); // returned `false`. White color is not the best for white background. return Color::of('#000000')->darkIsBetter(); // returned `false`. Black color is not the best for black background.
You can also use the converter:
use DragonCode\WhichColor\Services\Converter; $converted = new Converter(); $rgb = $converted->hex2rgb('#fa000a'); // RGB object with [250, 0, 10] // $rgb->red; // 250 // $rgb->green; // 0 // $rgb->blue; // 10 // $rgb->toArray(); // [250, 0, 10] $converted->hex2rgb('#f5a'); // RGB object with [255, 85, 170] $converted->hex2rgb('#ff55aa'); // RGB object with [255, 85, 170] $converted->rgb2hex($rgb); // '#fa000a' $converted->rgb2hex([250, 0, 10]); // '#fa000a' $converted->rgb2hex(['red' => 250, 'green' => 0, 'blue' => 10]); // '#fa000a' $converted->rgb2hex(['r' => 250, 'g' => 0, 'b' => 10]); // '#fa000a'
Example
License
This package is licensed under the MIT License.
dragon-code/which-color 适用场景与选型建议
dragon-code/which-color 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.19k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2021 年 12 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「color」 「dragon」 「which color」 「text-color」 「andrey-helldar」 「dragon-code」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 dragon-code/which-color 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dragon-code/which-color 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 dragon-code/which-color 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Locate a binaries by means of exec() or similar
Performing any actions during the deployment process
Support package is a collection of helpers and tools for any project.
Simple conversion of an array to a pretty view
Find the instances of an executable in the system path. Like the `which` Linux command.
Various helper files for the Laravel and Lumen frameworks
统计信息
- 总下载量: 7.19k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-12-19
