定制 hasbridge/php-color 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

hasbridge/php-color

Composer 安装命令:

composer require hasbridge/php-color

包简介

Color utility class for PHP 5.3 that allows for easy conversion between RGB, HSV, XYZ, and Lab colorspaces, as well as color comparison

README 文档

README

Travis CI Code Climate Test Coverage

This class is intended to make it easier to convert between colorspaces, as well as compare one color to another.

Requirements

  • PHP 5.3 or greater (closure support is required)

Examples:

Initialize object (using hex notation is easier if you are familiar with CSS colors):

$color = new Color(0xFFFFFF);

Get distance from another color using the RGB colorspace:

$color1 = new Color(0xFFFFFF);
$color2 = new Color(0x888888);

$distance = $color1->getDistanceRgbFrom($color2);

Get closest matching color using the Lab(CIE) colorspace:

$color = new Color(0xFFFFFF);

$palette = array(
    0x000000,
    0x888888,
    0xAAAAAA
);

$matchIndex = $color->getClosestMatch($palette);
$matchColor = $palette[$matchIndex];

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 24
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-02-08