承接 kachnitel/color-converter 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kachnitel/color-converter

最新稳定版本:v0.0.1

Composer 安装命令:

composer require kachnitel/color-converter

包简介

Lightweight PHP library for color format conversion (hex, RGB, HSL) and luminance calculation

README 文档

README

Lightweight PHP library for color format conversion and luminance calculation.

Features

  • Convert hex colors to RGB
  • Convert hex colors to HSL
  • Determine if a color is light or dark based on luminance
  • Pure PHP with no dependencies
  • Fully tested

Installation

composer require kachnitel/color-converter

Usage

use Kachnitel\ColorConverter\ColorConverter;

$converter = new ColorConverter();

// Convert hex to RGB
$rgb = $converter->hex2rgb('#ff5733');
// ['r' => 255, 'g' => 87, 'b' => 51]

// Convert hex to HSL
$hsl = $converter->hex2hsl('#ff5733');
// ['h' => 11, 's' => 100, 'l' => 60]

// Check if color is light or dark
$isLight = $converter->isLight('#ff5733');
// false (dark color)

// Custom threshold for light/dark detection
$isLight = $converter->isLight('#ff5733', 70);
// true (with higher threshold)

Testing

composer install
vendor/bin/phpunit

License

MIT

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-05