Color
in package
Tags
Table of Contents
- AVAILABLE_OPTIONS = ['bold' => ['set' => 1, 'unset' => 22], 'underscore' => ['set' => 4, 'unset' => 24], 'blink' => ['set' => 5, 'unset' => 25], 'reverse' => ['set' => 7, 'unset' => 27], 'conceal' => ['set' => 8, 'unset' => 28]]
- BRIGHT_COLORS = ['gray' => 0, 'bright-red' => 1, 'bright-green' => 2, 'bright-yellow' => 3, 'bright-blue' => 4, 'bright-magenta' => 5, 'bright-cyan' => 6, 'bright-white' => 7]
- COLORS = ['black' => 0, 'red' => 1, 'green' => 2, 'yellow' => 3, 'blue' => 4, 'magenta' => 5, 'cyan' => 6, 'white' => 7, 'default' => 9]
- $background : mixed
- $foreground : mixed
- $options : mixed
- __construct() : mixed
- apply() : string
- set() : string
- unset() : string
- convertHexColorToAnsi() : string
- degradeHexColorToAnsi() : int
- getSaturation() : int
- parseColor() : string
Constants
AVAILABLE_OPTIONS
private
mixed
AVAILABLE_OPTIONS
= ['bold' => ['set' => 1, 'unset' => 22], 'underscore' => ['set' => 4, 'unset' => 24], 'blink' => ['set' => 5, 'unset' => 25], 'reverse' => ['set' => 7, 'unset' => 27], 'conceal' => ['set' => 8, 'unset' => 28]]
BRIGHT_COLORS
private
mixed
BRIGHT_COLORS
= ['gray' => 0, 'bright-red' => 1, 'bright-green' => 2, 'bright-yellow' => 3, 'bright-blue' => 4, 'bright-magenta' => 5, 'bright-cyan' => 6, 'bright-white' => 7]
COLORS
private
mixed
COLORS
= ['black' => 0, 'red' => 1, 'green' => 2, 'yellow' => 3, 'blue' => 4, 'magenta' => 5, 'cyan' => 6, 'white' => 7, 'default' => 9]
Properties
$background
private
mixed
$background
$foreground
private
mixed
$foreground
$options
private
mixed
$options
= []
Methods
__construct()
public
__construct([string $foreground = '' ][, string $background = '' ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $foreground : string = ''
- $background : string = ''
- $options : array<string|int, mixed> = []
Return values
mixed —apply()
public
apply(string $text) : string
Parameters
- $text : string
Return values
string —set()
public
set() : string
Return values
string —unset()
public
unset() : string
Return values
string —convertHexColorToAnsi()
private
convertHexColorToAnsi(int $color) : string
Parameters
- $color : int
Return values
string —degradeHexColorToAnsi()
private
degradeHexColorToAnsi(int $r, int $g, int $b) : int
Parameters
- $r : int
- $g : int
- $b : int
Return values
int —getSaturation()
private
getSaturation(int $r, int $g, int $b) : int
Parameters
- $r : int
- $g : int
- $b : int
Return values
int —parseColor()
private
parseColor(string $color[, bool $background = false ]) : string
Parameters
- $color : string
- $background : bool = false