jalaljaberi/negarity-color 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

jalaljaberi/negarity-color

Composer 安装命令:

composer require jalaljaberi/negarity-color

包简介

Negarity Color — a modern, extensible color manipulation library for PHP.

README 文档

README

Negarity Color is a modern, extensible color manipulation library for PHP 8.3+.

Installation

composer require jalaljaberi/negarity-color

Basic Usage

<?php

require_once __DIR__ . '/vendor/autoload.php';

use Negarity\Color\Color;

// Create colors
$primary = Color::rgb(255, 100, 50);
$secondary = Color::hex('#3498db');

// Convert between color spaces
$hsl = $primary->toHSL();
$cmyk = $primary->toCMYK();

// Read channels
$r = $primary->getR();        // 255
$space = $primary->getColorSpaceName(); // "rgb"

// Modify (immutable by default)
$lighter = $primary->with(['g' => 150]);

echo $primary->toHex();   // "#FF6432"
echo (string) $hsl;       // "hsl(...)"

Configuration (Optional)

Named colors

Register a named-color registry once, then use Color::{name}():

use Negarity\Color\Color;
use Negarity\Color\Registry\VGANamedColors;

Color::addRegistry(new VGANamedColors());

$red = Color::red();
$navyHsl = Color::navy(\Negarity\Color\ColorSpace\HSL::class);

Filters

Filters must be registered before they are available as methods on Color objects:

use Negarity\Color\Color;
use Negarity\Color\Filter\FilterRegistry;
use Negarity\Color\Filter\Parameterized\BrightnessFilter;
use Negarity\Color\Filter\Unary\InvertFilter;

FilterRegistry::register(new BrightnessFilter());
FilterRegistry::register(new InvertFilter());

$color = Color::rgb(255, 100, 50)
    ->brightness(20)
    ->invert();

Documentation

Getting started

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-29