PHP code example of fyre / color
1. Go to this page and download the library: Download fyre/color library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fyre / color example snippets
use Fyre\Color\Color;
$color = Color::createFromString($string);
$color = Color::createFromA98Rgb($red, $green, $blue, $alpha);
$color = Color::createFromDisplayP3($red, $green, $blue, $alpha);
$color = Color::createFromDisplayP3Linear($red, $green, $blue, $alpha);
$color = Color::createFromHsl($hue, $saturation, $lightness, $alpha);
$color = Color::createFromHwb($hue, $whiteness, $blackness, $alpha);
$color = Color::createFromLab($lightness, $a, $b, $alpha);
$color = Color::createFromLch($lightness, $chroma, $hue, $alpha);
$color = Color::createFromOkLab($lightness, $a, $b, $alpha);
$color = Color::createFromOkLch($lightness, $chroma, $hue, $alpha);
$color = Color::createFromProPhotoRgb($red, $green, $blue, $alpha);
$color = Color::createFromRec2020($red, $green, $blue, $alpha);
$color = Color::createFromRgb($red, $green, $blue, $alpha);
$color = Color::createFromSrgb($red, $green, $blue, $alpha);
$color = Color::createFromSrgbLinear($red, $green, $blue, $alpha);
$color = Color::createFromXyzD50($x, $y, $z, $alpha);
$color = Color::createFromXyzD65($x, $y, $z, $alpha);
$contrast = $color->contrast($other);
$alpha = $color->getAlpha();
$label = $color->label();
$luma = $color->luma();
$space = $color->space();
$newColor = $color->to($space);
$newColor = $color->toA98Rgb();
$data = $color->toArray();
$newColor = $color->toDisplayP3();
$newColor = $color->toDisplayP3Linear();
$newColor = $color->toHex();
$newColor = $color->toHsl();
$newColor = $color->toHwb();
$newColor = $color->toLab();
$newColor = $color->toLch();
$newColor = $color->toOkLab();
$newColor = $color->toOkLch();
$newColor = $color->toProPhotoRgb();
$newColor = $color->toRec2020();
$newColor = $color->toRgb();
$newColor = $color->toSrgb();
$newColor = $color->toSrgbLinear();
$colorString = $color->toString($alpha, $precision);
$newColor = $color->toXyzD50();
$newColor = $color->toXyzD65();
$newColor = $color->withAlpha($alpha);
use Fyre\Color\Colors\A98Rgb;
$blue = $color->getBlue();
$green = $color->getGreen();
$red = $color->getRed();
$newColor = $color->withBlue($blue);
$newColor = $color->withGreen($green);
$newColor = $color->withRed($red);
use Fyre\Color\Colors\DisplayP3;
$blue = $color->getBlue();
$green = $color->getGreen();
$red = $color->getRed();
$newColor = $color->withBlue($blue);
$newColor = $color->withGreen($green);
$newColor = $color->withRed($red);
use Fyre\Color\Colors\DisplayP3Linear;
$blue = $color->getBlue();
$green = $color->getGreen();
$red = $color->getRed();
$newColor = $color->withBlue($blue);
$newColor = $color->withGreen($green);
$newColor = $color->withRed($red);
use Fyre\Color\Colors\Hex;
$blue = $color->getBlue();
$green = $color->getGreen();
$red = $color->getRed();
$colorString = $color->toString($alpha, $precision, $shortenHex, $name);
$newColor = $color->withBlue($blue);
$newColor = $color->withGreen($green);
$newColor = $color->withRed($red);
use Fyre\Color\Colors\Hsl;
$hue = $color->getHue();
$lightness = $color->getLightness();
$saturation = $color->getSaturation();
$newColor = $color->withHue($hue);
$newColor = $color->withLightness($lightness);
$newColor = $color->withSaturation($saturation);
use Fyre\Color\Colors\Hwb;
$blackness = $color->getBlackness();
$hue = $color->getHue();
$whiteness = $color->getWhiteness();
$newColor = $color->withBlackness($blackness);
$newColor = $color->withHue($hue);
$newColor = $color->withWhiteness($whiteness);
use Fyre\Color\Colors\Lab;
$a = $color->getA();
$b = $color->getB();
$lightness = $color->getLightness();
$newColor = $color->withA($a);
$newColor = $color->withB($b);
$newColor = $color->withLightness($lightness);
use Fyre\Color\Colors\Lch;
$chroma = $color->getChroma();
$hue = $color->getHue();
$lightness = $color->getLightness();
$newColor = $color->withChroma($chroma);
$newColor = $color->withHue($hue);
php
$newColor = $color->withLightness($lightness);
php
$a = $color->getA();
php
$b = $color->getB();
php
$lightness = $color->getLightness();
php
$newColor = $color->withA($a);
php
$newColor = $color->withB($b);
php
$newColor = $color->withLightness($lightness);
php
$chroma = $color->getChroma();
php
$hue = $color->getHue();
php
$lightness = $color->getLightness();
php
$newColor = $color->withChroma($chroma);
php
$newColor = $color->withHue($hue);
php
$newColor = $color->withLightness($lightness);
php
$blue = $color->getBlue();
php
$green = $color->getGreen();
php
$red = $color->getRed();
php
$newColor = $color->withBlue($blue);
php
$newColor = $color->withGreen($green);
php
$newColor = $color->withRed($red);
php
$blue = $color->getBlue();
php
$green = $color->getGreen();
php
$red = $color->getRed();
php
$newColor = $color->withBlue($blue);
php
$newColor = $color->withGreen($green);
php
$newColor = $color->withRed($red);
php
$blue = $color->getBlue();
php
$green = $color->getGreen();
php
$red = $color->getRed();
php
$colorString = $color->toString($alpha, $precision, $name);
php
$newColor = $color->withBlue($blue);
php
$newColor = $color->withGreen($green);
php
$newColor = $color->withRed($red);
php
$blue = $color->getBlue();
php
$green = $color->getGreen();
php
$red = $color->getRed();
php
$newColor = $color->withBlue($blue);
php
$newColor = $color->withGreen($green);
php
$newColor = $color->withRed($red);
php
$blue = $color->getBlue();
php
$green = $color->getGreen();
php
$red = $color->getRed();
php
$newColor = $color->withBlue($blue);
php
$newColor = $color->withGreen($green);
php
$newColor = $color->withRed($red);
php
$x = $color->getX();
php
$y = $color->getY();
php
$z = $color->getZ();
php
$newColor = $color->withX($x);
php
$newColor = $color->withY($y);
php
$newColor = $color->withZ($z);
php
$x = $color->getX();
php
$y = $color->getY();
php
$z = $color->getZ();
php
$newColor = $color->withX($x);
php
$newColor = $color->withY($y);
php
$newColor = $color->withZ($z);