PHPackages                             fyre/color - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. fyre/color

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

fyre/color
==========

A color library.

v3.0.3(6mo ago)2221MITPHP

Since May 20Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/elusivecodes/FyreColor)[ Packagist](https://packagist.org/packages/fyre/color)[ RSS](/packages/fyre-color/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (23)Used By (1)

FyreColor
=========

[](#fyrecolor)

**FyreColor** is a free, open-source immutable color manipulation library for *PHP*.

It is a modern library, and features full support for all CSS color-spaces.

Table Of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Color Creation](#color-creation)
- [Colors](#colors)
    - [A98 Rgb](#a98-rgb)
    - [Display P3](#display-p3)
    - [Display P3 Linear](#display-p3-linear)
    - [Hex](#hex)
    - [Hsl](#hsl)
    - [Hwb](#hwb)
    - [Lab](#lab)
    - [Lch](#lch)
    - [OkLab](#oklab)
    - [OkLch](#oklch)
    - [ProPhoto Rgb](#prophoto-rgb)
    - [Rec2020](#rec2020)
    - [Rgb](#rgb)
    - [Srgb](#srgb)
    - [Srgb Linear](#srgb-linear)
    - [Xyz D50](#xyz-d50)
    - [Xyz D65](#xyz-d65)

Installation
------------

[](#installation)

**Using Composer**

```
composer require fyre/color

```

In PHP:

```
use Fyre\Color\Color;
```

Basic Usage
-----------

[](#basic-usage)

- `$string` is a string representing the CSS color.

```
$color = Color::createFromString($string);
```

Color Creation
--------------

[](#color-creation)

**Create From A98 RGB**

- `$red` is a number between 0 and *1*, and will default to 0.
- `$green` is a number between 0 and *1*, and will default to 0.
- `$blue` is a number between 0 and *1*, and will default to 0.
- `$alpha` is a number between 0 and *1*, and will default to *1*.

```
$color = Color::createFromA98Rgb($red, $green, $blue, $alpha);
```

**Create From Display P3**

- `$red` is a number between 0 and *1*, and will default to 0.
- `$green` is a number between 0 and *1*, and will default to 0.
- `$blue` is a number between 0 and *1*, and will default to 0.
- `$alpha` is a number between 0 and *1*, and will default to *1*.

```
$color = Color::createFromDisplayP3($red, $green, $blue, $alpha);
```

**Create From Display P3 Linear**

- `$red` is a number between 0 and *1*, and will default to 0.
- `$green` is a number between 0 and *1*, and will default to 0.
- `$blue` is a number between 0 and *1*, and will default to 0.
- `$alpha` is a number between 0 and *1*, and will default to *1*.

```
$color = Color::createFromDisplayP3Linear($red, $green, $blue, $alpha);
```

**Create From HSL**

- `$hue` is a number between 0 and *360*, and will default to 0.
- `$saturation` is a number between 0 and *100*, and will default to 0.
- `$lightness` is a number between 0 and *100*, and will default to 0.
- `$alpha` is a number between 0 and *1*, and will default to *1*.

```
$color = Color::createFromHsl($hue, $saturation, $lightness, $alpha);
```

**Create From HWB**

- `$hue` is a number between 0 and *360*, and will default to 0.
- `$whiteness` is a number between 0 and *100*, and will default to 0.
- `$blackness` is a number between 0 and *100*, and will default to 0.
- `$alpha` is a number between 0 and *1*, and will default to *1*.

```
$color = Color::createFromHwb($hue, $whiteness, $blackness, $alpha);
```

**Create From Lab**

- `$lightness` is a number between 0 and *100*, and will default to 0.
- `$a` is a number between *-128* and *127*, and will default to 0.
- `$b` is a number between *-128* and *127*, and will default to 0.
- `$alpha` is a number between 0 and *1*, and will default to *1*.

```
$color = Color::createFromLab($lightness, $a, $b, $alpha);
```

**Create From Lch**

- `$lightness` is a number between 0 and *100*, and will default to 0.
- `$chroma` is a number between 0 and *230*, and will default to 0.
- `$hue` is a number between 0 and *360*, and will default to 0.
- `$alpha` is a number between 0 and *1*, and will default to *1*.

```
$color = Color::createFromLch($lightness, $chroma, $hue, $alpha);
```

**Create From OkLab**

- `$lightness` is a number between 0 and *1*, and will default to 0.
- `$a` is a number between *-0.4* and *0.4*, and will default to 0.
- `$b` is a number between *-0.4* and *0.4*, and will default to 0.
- `$alpha` is a number between 0 and *1*, and will default to *1*.

```
$color = Color::createFromOkLab($lightness, $a, $b, $alpha);
```

**Create From OkLch**

- `$lightness` is a number between 0 and *1*, and will default to 0.
- `$chroma` is a number between 0 and *0.4*, and will default to 0.
- `$hue` is a number between 0 and *360*, and will default to 0.
- `$alpha` is a number between 0 and *1*, and will default to *1*.

```
$color = Color::createFromOkLch($lightness, $chroma, $hue, $alpha);
```

**Create From ProPhoto Rgb**

- `$red` is a number between 0 and *1*, and will default to 0.
- `$green` is a number between 0 and *1*, and will default to 0.
- `$blue` is a number between 0 and *1*, and will default to 0.
- `$alpha` is a number between 0 and *1*, and will default to *1*.

```
$color = Color::createFromProPhotoRgb($red, $green, $blue, $alpha);
```

**Create From Rec 2020**

- `$red` is a number between 0 and *1*, and will default to 0.
- `$green` is a number between 0 and *1*, and will default to 0.
- `$blue` is a number between 0 and *1*, and will default to 0.
- `$alpha` is a number between 0 and *1*, and will default to *1*.

```
$color = Color::createFromRec2020($red, $green, $blue, $alpha);
```

**Create From Rgb**

- `$red` is a number between 0 and *255*, and will default to 0.
- `$green` is a number between 0 and *255*, and will default to 0.
- `$blue` is a number between 0 and *255*, and will default to 0.
- `$alpha` is a number between 0 and *1*, and will default to *1*.

```
$color = Color::createFromRgb($red, $green, $blue, $alpha);
```

**Create From Srgb**

- `$red` is a number between 0 and *1*, and will default to 0.
- `$green` is a number between 0 and *1*, and will default to 0.
- `$blue` is a number between 0 and *1*, and will default to 0.
- `$alpha` is a number between 0 and *1*, and will default to *1*.

```
$color = Color::createFromSrgb($red, $green, $blue, $alpha);
```

**Create From Srgb Linear**

- `$red` is a number between 0 and *1*, and will default to 0.
- `$green` is a number between 0 and *1*, and will default to 0.
- `$blue` is a number between 0 and *1*, and will default to 0.
- `$alpha` is a number between 0 and *1*, and will default to *1*.

```
$color = Color::createFromSrgbLinear($red, $green, $blue, $alpha);
```

**Create From Xyz D50**

- `$x` is a number between 0 and *1*, and will default to 0.
- `$y` is a number between 0 and *1*, and will default to 0.
- `$z` is a number between 0 and *1*, and will default to 0.
- `$alpha` is a number between 0 and *1*, and will default to *1*.

```
$color = Color::createFromXyzD50($x, $y, $z, $alpha);
```

**Create From Xyz D65**

- `$x` is a number between 0 and *1*, and will default to 0.
- `$y` is a number between 0 and *1*, and will default to 0.
- `$z` is a number between 0 and *1*, and will default to 0.
- `$alpha` is a number between 0 and *1*, and will default to *1*.

```
$color = Color::createFromXyzD65($x, $y, $z, $alpha);
```

Colors
------

[](#colors)

**Contrast**

Calculate the contrast between this and another *Color*.

- `$other` is a *Color*.

```
$contrast = $color->contrast($other);
```

**Get Alpha**

Get the alpha value.

```
$alpha = $color->getAlpha();
```

**Label**

Find the closest HTML color name for this color (in current color space).

```
$label = $color->label();
```

**Luma**

Calculate the relative luminance value.

```
$luma = $color->luma();
```

**Space**

Get the current color space.

```
$space = $color->space();
```

**To**

Convert the *Color* to a named color space.

- `$space` is a string representing the color space, and must be one of either "*a98-rgb*", "*display-p3*", "*display-p3-linear*", "*hex*", "*hsl*", "*hwb*", "*lab*", "*lch*", "*oklab*", "*oklch*", "*prophoto-rgb*", "*rec2020*", "*rgb*", "*srgb*", "*srgb-linear*", "*xyz-d50*" or "*xyz-d65*".

```
$newColor = $color->to($space);
```

**To A98 RGB**

Convert the *Color* to [*A98Rgb*](#a98-rgb).

```
$newColor = $color->toA98Rgb();
```

**To Array**

Get the color components as an array.

```
$data = $color->toArray();
```

**To Display P3**

Convert the *Color* to [*DisplayP3*](#display-p3).

```
$newColor = $color->toDisplayP3();
```

**To Display P3 Linear**

Convert the *Color* to [*DisplayP3Linear*](#display-p3-linear).

```
$newColor = $color->toDisplayP3Linear();
```

**To Hex**

Convert the *Color* to [*Hex*](#hex).

```
$newColor = $color->toHex();
```

**To HSL**

Convert the *Color* to [*Hsl*](#hsl).

```
$newColor = $color->toHsl();
```

**To HWB**

Convert the *Color* to [*Hwb*](#hwb).

```
$newColor = $color->toHwb();
```

**To Lab**

Convert the *Color* to [*Lab*](#lab).

```
$newColor = $color->toLab();
```

**To Lch**

Convert the *Color* to [*Lch*](#lch).

```
$newColor = $color->toLch();
```

**To OkLab**

Convert the *Color* to [*OkLab*](#oklab).

```
$newColor = $color->toOkLab();
```

**To OkLch**

Convert the *Color* to [*OkLch*](#oklch).

```
$newColor = $color->toOkLch();
```

**To ProPhoto Rgb**

Convert the *Color* to [*ProPhotoRgb*](#prophoto-rgb).

```
$newColor = $color->toProPhotoRgb();
```

**To Rec 2020**

Convert the *Color* to [*Rec2020*](#rec2020).

```
$newColor = $color->toRec2020();
```

**To Rgb**

Convert the *Color* to [*Rgb*](#rgb).

```
$newColor = $color->toRgb();
```

**To Srgb**

Convert the *Color* to [*Srgb*](#srgb).

```
$newColor = $color->toSrgb();
```

**To Srgb Linear**

Convert the *Color* to [*SrgbLinear*](#srgb-linear).

```
$newColor = $color->toSrgbLinear();
```

**To String**

Get the CSS color string.

- `$alpha` is a boolean indicating whether to include the alpha component in the string, and will default to *null*.
- `$precision` is a number representing the decimal precision, and will default to *2*.

```
$colorString = $color->toString($alpha, $precision);
```

**To Xyz D50**

Convert the *Color* to [*XyzD50*](#xyz-d50).

```
$newColor = $color->toXyzD50();
```

**To Xyz D65**

Convert the *Color* to [*XyzD65*](#xyz-d65).

```
$newColor = $color->toXyzD65();
```

**With Alpha**

Clone the *Color* with a new alpha value.

- `$alpha` is a number between 0 and *1*.

```
$newColor = $color->withAlpha($alpha);
```

### A98 RGB

[](#a98-rgb)

```
use Fyre\Color\Colors\A98Rgb;
```

**Get Blue**

Get the blue value.

```
$blue = $color->getBlue();
```

**Get Green**

Get the green value.

```
$green = $color->getGreen();
```

**Get Red**

Get the red value.

```
$red = $color->getRed();
```

**With Blue**

Clone the *Color* with a new blue value.

- `$blue` is a number between 0 and *1*.

```
$newColor = $color->withBlue($blue);
```

**With Green**

Clone the *Color* with a new green value.

- `$green` is a number between 0 and *1*.

```
$newColor = $color->withGreen($green);
```

**With Red**

Clone the *Color* with a new red value.

- `$red` is a number between 0 and *1*.

```
$newColor = $color->withRed($red);
```

### Display P3

[](#display-p3)

```
use Fyre\Color\Colors\DisplayP3;
```

**Get Blue**

Get the blue value.

```
$blue = $color->getBlue();
```

**Get Green**

Get the green value.

```
$green = $color->getGreen();
```

**Get Red**

Get the red value.

```
$red = $color->getRed();
```

**With Blue**

Clone the *Color* with a new blue value.

- `$blue` is a number between 0 and *1*.

```
$newColor = $color->withBlue($blue);
```

**With Green**

Clone the *Color* with a new green value.

- `$green` is a number between 0 and *1*.

```
$newColor = $color->withGreen($green);
```

**With Red**

Clone the *Color* with a new red value.

- `$red` is a number between 0 and *1*.

```
$newColor = $color->withRed($red);
```

### Display P3 Linear

[](#display-p3-linear)

```
use Fyre\Color\Colors\DisplayP3Linear;
```

**Get Blue**

Get the blue value.

```
$blue = $color->getBlue();
```

**Get Green**

Get the green value.

```
$green = $color->getGreen();
```

**Get Red**

Get the red value.

```
$red = $color->getRed();
```

**With Blue**

Clone the *Color* with a new blue value.

- `$blue` is a number between 0 and *1*.

```
$newColor = $color->withBlue($blue);
```

**With Green**

Clone the *Color* with a new green value.

- `$green` is a number between 0 and *1*.

```
$newColor = $color->withGreen($green);
```

**With Red**

Clone the *Color* with a new red value.

- `$red` is a number between 0 and *1*.

```
$newColor = $color->withRed($red);
```

### Hex

[](#hex)

```
use Fyre\Color\Colors\Hex;
```

**Get Blue**

Get the blue value.

```
$blue = $color->getBlue();
```

**Get Green**

Get the green value.

```
$green = $color->getGreen();
```

**Get Red**

Get the red value.

```
$red = $color->getRed();
```

**To String**

Get the CSS color string.

- `$alpha` is a boolean indicating whether to include the alpha component in the string, and will default to *null*.
- `$precision` is a number representing the decimal precision, and will default to *2* (unused).
- `$shortenHex` is a boolean indicating whether shorten hex output, and will default to *true*.
- `$name` is a boolean indicating whether to use CSS color names, and will default to *false*.

```
$colorString = $color->toString($alpha, $precision, $shortenHex, $name);
```

**With Blue**

Clone the *Color* with a new blue value.

- `$blue` is a number between 0 and *255*.

```
$newColor = $color->withBlue($blue);
```

**With Green**

Clone the *Color* with a new green value.

- `$green` is a number between 0 and *255*.

```
$newColor = $color->withGreen($green);
```

**With Red**

Clone the *Color* with a new red value.

- `$red` is a number between 0 and *255*.

```
$newColor = $color->withRed($red);
```

### Hsl

[](#hsl)

```
use Fyre\Color\Colors\Hsl;
```

**Get Hue**

Get the hue value.

```
$hue = $color->getHue();
```

**Get Lightness**

Get the lightness value.

```
$lightness = $color->getLightness();
```

**Get Saturation**

Get the saturation value.

```
$saturation = $color->getSaturation();
```

**With Hue**

Clone the *Color* with a new hue value.

- `$hue` is a number between 0 and *360*.

```
$newColor = $color->withHue($hue);
```

**With Lightness**

Clone the *Color* with a new lightness value.

- `$lightness` is a number between 0 and *100*.

```
$newColor = $color->withLightness($lightness);
```

**With Saturation**

Clone the *Color* with a new saturation value.

- `$saturation` is a number between 0 and *100*.

```
$newColor = $color->withSaturation($saturation);
```

### Hwb

[](#hwb)

```
use Fyre\Color\Colors\Hwb;
```

**Get Blackness**

Get the blackness value.

```
$blackness = $color->getBlackness();
```

**Get Hue**

Get the hue value.

```
$hue = $color->getHue();
```

**Get Whiteness**

Get the whiteness value.

```
$whiteness = $color->getWhiteness();
```

**With Blackness**

Clone the *Color* with a new blackness value.

- `$blackness` is a number between 0 and *100*.

```
$newColor = $color->withBlackness($blackness);
```

**With Hue**

Clone the *Color* with a new hue value.

- `$hue` is a number between 0 and *360*.

```
$newColor = $color->withHue($hue);
```

**With Whiteness**

Clone the *Color* with a new whiteness value.

- `$whiteness` is a number between 0 and *100*.

```
$newColor = $color->withWhiteness($whiteness);
```

### Lab

[](#lab)

```
use Fyre\Color\Colors\Lab;
```

**Get A**

Get the a value.

```
$a = $color->getA();
```

**Get B**

Get the b value.

```
$b = $color->getB();
```

**Get Lightness**

Get the lightness value.

```
$lightness = $color->getLightness();
```

**With A**

Clone the *Color* with a new a value.

- `$a` is a number between *-128* and *127*.

```
$newColor = $color->withA($a);
```

**With B**

- `$b` is a number between *-128* and *127*.

```
$newColor = $color->withB($b);
```

**With Lightness**

Clone the *Color* with a new lightness value.

- `$lightness` is a number between 0 and *100*.

```
$newColor = $color->withLightness($lightness);
```

### Lch

[](#lch)

```
use Fyre\Color\Colors\Lch;
```

**Get Chroma**

Get the chroma value.

```
$chroma = $color->getChroma();
```

**Get Hue**

Get the hue value.

```
$hue = $color->getHue();
```

**Get Lightness**

Get the lightness value.

```
$lightness = $color->getLightness();
```

**With Chroma**

Clone the *Color* with a new chroma value.

- `$chroma` is a number between 0 and *230*.

```
$newColor = $color->withChroma($chroma);
```

**With Hue**

Clone the *Color* with a new hue value.

- `$hue` is a number between 0 and *360*.

```
$newColor = $color->withHue($hue);
```

**With Lightness**

Clone the *Color* with a new lightness value.

- `$lightness` is a number between 0 and *100*.

```
$newColor = $color->withLightness($lightness);
```

### OkLab

[](#oklab)

```
use Fyre\Color\Colors\OkLab;
```

**Get A**

Get the a value.

```
$a = $color->getA();
```

**Get B**

Get the b value.

```
$b = $color->getB();
```

**Get Lightness**

Get the lightness value.

```
$lightness = $color->getLightness();
```

**With A**

Clone the *Color* with a new a value.

- `$a` is a number between *-0.4* and *0.4*.

```
$newColor = $color->withA($a);
```

**With B**

- `$b` is a number between *-0.4* and *0.4*.

```
$newColor = $color->withB($b);
```

**With Lightness**

Clone the *Color* with a new lightness value.

- `$lightness` is a number between 0 and *1*.

```
$newColor = $color->withLightness($lightness);
```

### OkLch

[](#oklch)

```
use Fyre\Color\Colors\OkLch;
```

**Get Chroma**

Get the chroma value.

```
$chroma = $color->getChroma();
```

**Get Hue**

Get the hue value.

```
$hue = $color->getHue();
```

**Get Lightness**

Get the lightness value.

```
$lightness = $color->getLightness();
```

**With Chroma**

Clone the *Color* with a new chroma value.

- `$chroma` is a number between 0 and *0.4*.

```
$newColor = $color->withChroma($chroma);
```

**With Hue**

Clone the *Color* with a new hue value.

- `$hue` is a number between 0 and *360*.

```
$newColor = $color->withHue($hue);
```

**With Lightness**

Clone the *Color* with a new lightness value.

- `$lightness` is a number between 0 and *1*.

```
$newColor = $color->withLightness($lightness);
```

### ProPhoto Rgb

[](#prophoto-rgb)

```
use Fyre\Color\Colors\ProPhotoRgb;
```

**Get Blue**

Get the blue value.

```
$blue = $color->getBlue();
```

**Get Green**

Get the green value.

```
$green = $color->getGreen();
```

**Get Red**

Get the red value.

```
$red = $color->getRed();
```

**With Blue**

Clone the *Color* with a new blue value.

- `$blue` is a number between 0 and *1*.

```
$newColor = $color->withBlue($blue);
```

**With Green**

Clone the *Color* with a new green value.

- `$green` is a number between 0 and *1*.

```
$newColor = $color->withGreen($green);
```

**With Red**

Clone the *Color* with a new red value.

- `$red` is a number between 0 and *1*.

```
$newColor = $color->withRed($red);
```

### Rec2020

[](#rec2020)

```
use Fyre\Color\Colors\Rec2020;
```

**Get Blue**

Get the blue value.

```
$blue = $color->getBlue();
```

**Get Green**

Get the green value.

```
$green = $color->getGreen();
```

**Get Red**

Get the red value.

```
$red = $color->getRed();
```

**With Blue**

Clone the *Color* with a new blue value.

- `$blue` is a number between 0 and *1*.

```
$newColor = $color->withBlue($blue);
```

**With Green**

Clone the *Color* with a new green value.

- `$green` is a number between 0 and *1*.

```
$newColor = $color->withGreen($green);
```

**With Red**

Clone the *Color* with a new red value.

- `$red` is a number between 0 and *1*.

```
$newColor = $color->withRed($red);
```

### Rgb

[](#rgb)

```
use Fyre\Color\Colors\Rgb;
```

**Get Blue**

Get the blue value.

```
$blue = $color->getBlue();
```

**Get Green**

Get the green value.

```
$green = $color->getGreen();
```

**Get Red**

Get the red value.

```
$red = $color->getRed();
```

**To String**

Get the CSS color string.

- `$alpha` is a boolean indicating whether to include the alpha component in the string, and will default to *null*.
- `$precision` is a number representing the decimal precision, and will default to *2*.
- `$name` is a boolean indicating whether to use CSS color names, and will default to *false*.

```
$colorString = $color->toString($alpha, $precision, $name);
```

**With Blue**

Clone the *Color* with a new blue value.

- `$blue` is a number between 0 and *255*.

```
$newColor = $color->withBlue($blue);
```

**With Green**

Clone the *Color* with a new green value.

- `$green` is a number between 0 and *255*.

```
$newColor = $color->withGreen($green);
```

**With Red**

Clone the *Color* with a new red value.

- `$red` is a number between 0 and *255*.

```
$newColor = $color->withRed($red);
```

### Srgb

[](#srgb)

```
use Fyre\Color\Colors\Srgb;
```

**Get Blue**

Get the blue value.

```
$blue = $color->getBlue();
```

**Get Green**

Get the green value.

```
$green = $color->getGreen();
```

**Get Red**

Get the red value.

```
$red = $color->getRed();
```

**With Blue**

Clone the *Color* with a new blue value.

- `$blue` is a number between 0 and *1*.

```
$newColor = $color->withBlue($blue);
```

**With Green**

Clone the *Color* with a new green value.

- `$green` is a number between 0 and *1*.

```
$newColor = $color->withGreen($green);
```

**With Red**

Clone the *Color* with a new red value.

- `$red` is a number between 0 and *1*.

```
$newColor = $color->withRed($red);
```

### Srgb Linear

[](#srgb-linear)

```
use Fyre\Color\Colors\SrgbLinear;
```

**Get Blue**

Get the blue value.

```
$blue = $color->getBlue();
```

**Get Green**

Get the green value.

```
$green = $color->getGreen();
```

**Get Red**

Get the red value.

```
$red = $color->getRed();
```

**With Blue**

Clone the *Color* with a new blue value.

- `$blue` is a number between 0 and *1*.

```
$newColor = $color->withBlue($blue);
```

**With Green**

Clone the *Color* with a new green value.

- `$green` is a number between 0 and *1*.

```
$newColor = $color->withGreen($green);
```

**With Red**

Clone the *Color* with a new red value.

- `$red` is a number between 0 and *1*.

```
$newColor = $color->withRed($red);
```

### Xyz D50

[](#xyz-d50)

```
use Fyre\Color\Colors\XyzD50;
```

**Get X**

Get the x value.

```
$x = $color->getX();
```

**Get Y**

Get the y value.

```
$y = $color->getY();
```

**Get Z**

Get the z value.

```
$z = $color->getZ();
```

**With X**

Clone the *Color* with a new x value.

- `$x` is a number between 0 and *1*.

```
$newColor = $color->withX($x);
```

**With Y**

Clone the *Color* with a new y value.

- `$y` is a number between 0 and *1*.

```
$newColor = $color->withY($y);
```

**With Z**

Clone the *Color* with a new z value.

- `$z` is a number between 0 and *1*.

```
$newColor = $color->withZ($z);
```

### Xyz D65

[](#xyz-d65)

```
use Fyre\Color\Colors\XyzD65;
```

**Get X**

Get the x value.

```
$x = $color->getX();
```

**Get Y**

Get the y value.

```
$y = $color->getY();
```

**Get Z**

Get the z value.

```
$z = $color->getZ();
```

**With X**

Clone the *Color* with a new x value.

- `$x` is a number between 0 and *1*.

```
$newColor = $color->withX($x);
```

**With Y**

Clone the *Color* with a new y value.

- `$y` is a number between 0 and *1*.

```
$newColor = $color->withY($y);
```

**With Z**

Clone the *Color* with a new z value.

- `$z` is a number between 0 and *1*.

```
$newColor = $color->withZ($z);
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance66

Regular maintenance activity

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~60 days

Recently: every ~24 days

Total

22

Last Release

197d ago

Major Versions

v1.0.1 → v2.02023-07-13

v2.1.5 → v3.02025-10-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/fad81fd5941e3a637c8a5749d05ae3ed9314d5e2fee57f59c3d9ec3b41259c6b?d=identicon)[elusivecodes](/maintainers/elusivecodes)

---

Top Contributors

[![elusivecodes](https://avatars.githubusercontent.com/u/18050480?v=4)](https://github.com/elusivecodes "elusivecodes (22 commits)")

---

Tags

cmycmykcolorhexhslhsvphprgbrgba

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/fyre-color/health.svg)

```
[![Health](https://phpackages.com/badges/fyre-color/health.svg)](https://phpackages.com/packages/fyre-color)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
