Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

🎨 Color helper library for converting between RGB, CMYK, HSV, HST and HEX and create interpolation

License

NotificationsYou must be signed in to change notification settings

artack/color

Repository files navigation

color conversions and transitions (e.g. interpolation).

Latest ReleaseMIT LicenseTotal Downloads

Developed byARTACK WebLab GmbH in Zurich, Switzerland.

Features

  • Provides class representation forRGB,CMYK,HSV,HSL andHEX.
  • Provides conversion between all class representation
  • Provides transitions between colors (e.g. interpolation)
  • Provides clear exceptions to be able to handle library exceptions
  • Compatible with PHP >= 7 and >= 8.

Installation

You can install this color library throughComposer:

$ composer require artack/color

Usage

Creating a RGB class representation:

$RGB =newRGB(0,255,0);echo$RGB->getGreen();// 255

Translate RGR class representation to HSV:

$converter = Factory::createConverter();$RGB =newRGB(0,255,0);$HSV =$converter->convert($RGB,HSV::class);

Get an interpolation color between two colors with the value (and max) given:

$transition = Factory::createTransition();$RGBRed =newRGB(255,0,0);// red$RGBGreen =newRGB(0,255,0);// green$RGBInterpolated =$transition->interpolate(RGB::class,$RGBRed,$RGBGreen,100,200);// should be ~yellow// Interpolation will give better results when using HSV Transition. Colors get converted automatically if needed.$HSVInterpolated =$transition->interpolate(HSV::class,$RGBRed,$RGBGreen,100,200);// should be ~yellow

About

🎨 Color helper library for converting between RGB, CMYK, HSV, HST and HEX and create interpolation

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp