Download the PHP package bugo/iris without Composer

On this page you can find all versions of the php package bugo/iris. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package iris

Iris

PHP Coverage Status

По-русски

Color space conversions, serialization, and operations for legacy and modern CSS colors.

Named after Iris, the goddess of the rainbow in Greek mythology.

Installation

Color spaces

Iris supports the legacy CSS spaces and the modern color spaces used by lab(), lch(), oklab(), oklch(), and color(...).

Class Space Channels
RgbColor rgb r, g, b (0-1), a (0-1)
HslColor hsl h (0-360), s (0-100), l (0-100), a (0-1)
HwbColor hwb h (0-360), w (0-100), b (0-100), a (0-1)
LabColor lab l (0-100), a, b, alpha (0-1)
LchColor lch l (0-100), c, h (0-360), alpha (0-1)
OklabColor oklab l (0-100), a, b, alpha (0-1)
OklchColor oklch l (0-100), c (0-0.4), h (0-360), a (0-1)
XyzColor xyz-* x, y, z

XyzColor is reused for both xyz-d65 and xyz-d50; the white point depends on the method or route you call.

Channel scales and conventions

RgbColor channels are always normalized to 0-1, on every API surface. The same object can be passed to SpaceConverter, CssSerializer, LiteralSerializer, ColorMixResolver, and the manipulators without rescaling, and rgbToX() / xToRgb() pairs are exact inverses of each other.

Bytes appear only at the input and output boundary:

Other spaces keep the scale their CSS function uses: HslColor and HwbColor use percentage-like 0-100 channels, LabColor, LchColor, OklabColor and OklchColor store lightness on 0-100, and chroma or a/b axes stay on their native numeric ranges.

SpaceRouter routes by string space name on top of the channel API. It is best suited for CSS color(<space> ...) flows, where spaces such as srgb, display-p3, rec2020, and xyz-* are passed around as normalized channel triples. lab, lch, oklab, and oklch are also accepted for symmetry, but the typed SpaceConverter methods are usually clearer when you already know the target space at compile time.

Migrating from 0.3

RgbColor no longer accepts byte channels. Divide existing values by 255, or let LiteralParser do it:

Other breaking changes:

When to use what

Usage

Creating color objects

Converting between color spaces

The *Channels* methods are the low-level channel API. Methods that accept color objects such as RgbColor or OklchColor remain object-oriented entry points; both operate on the same normalized sRGB channels, so rgbToOklch() and oklchToRgb() round-trip exactly.

Routing by space name

Color manipulations

Gamut mapping

GamutMapper maps out-of-sRGB-gamut colors back into gamut using two algorithms from CSS Color Level 4.

Both methods accept and return OklchColor. For other spaces, convert to OklchColor first.

CSS color-mix() interpolation

ColorMixResolver implements CSS Color Level 4 interpolation rules, including none channel handling and all four hue interpolation methods.

If one side uses null for a channel, the other side wins instead of interpolating. If both sides are null, the result stays null.

Every mix*() method takes an optional $premultiplied flag. Per CSS Color Level 4, interpolation should happen in premultiplied form when alpha differs between the two colors; the hue channel of cylindrical spaces is never premultiplied. Serializer enables the flag when resolving color-mix().

Hex encoding

Parsing CSS color literals

Serializer vs CssSerializer

Use Serializer when the input is already a CSS string and you want normalization or optional hex conversion.

Use CssSerializer when the input is a typed color object and you want a CSS function string.

If you specifically need hex from an RgbColor, call CssSerializer::toHex() or LiteralSerializer. Both read the same normalized channels; LiteralSerializer additionally prefers a CSS named color when one matches exactly.

Model conversion

Perceptual manipulations

Linear RGB manipulations

Wide-gamut color spaces

Polar math utilities

Named colors

NamedColors::NAMED_RGB stores byte-like channel values, mirroring the CSS named color table. Use LiteralParser::toRgb() to get a normalized RgbColor from a name.

ColorValueInterface

All Spaces/* classes implement Bugo\Iris\Contracts\ColorValueInterface.

Exceptions

All exceptions extend IrisException, which extends \RuntimeException.

Comparison with other implementations

See comparisons_results.md for the results.

Useful links


All versions of iris with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-ctype Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bugo/iris contains the following files

Loading the files please wait ...