Uh oh!
There was an error while loading. Please reload this page.
This repository was archived by the owner on Jan 24, 2019. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCliColors.php
More file actions
Latest commit
47 lines (47 loc) · 1.28 KB
/
Copy pathCliColors.php
File metadata and controls
47 lines (47 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
namespaceRedCat\Debug;
abstractclass CliColors{
privatestatic$foreground_colors = [
'black' => '0;30',
'dark_gray' => '1;30',
'blue' => '0;34',
'light_blue' => '1;34',
'green' => '0;32',
'light_green' => '1;32',
'cyan' => '0;36',
'light_cyan' => '1;36',
'red' => '0;31',
'light_red' => '1;31',
'purple' => '0;35',
'light_purple' => '1;35',
'brown' => '0;33',
'yellow' => '1;33',
'light_gray' => '0;37',
'white' => '1;37',
];
privatestatic$background_colors = [
'black' => '40',
'red' => '41',
'green' => '42',
'yellow' => '43',
'blue' => '44',
'magenta' => '45',
'cyan' => '46',
'light_gray' => '47',
];
staticfunctionwrap($string, $foreground_color = null, $background_color = null) {
$colored_string = '';
if(isset(self::$foreground_colors[$foreground_color]))
$colored_string .= "\033[" . self::$foreground_colors[$foreground_color] . "m";
if(isset(self::$background_colors[$background_color]))
$colored_string .= "\033[" . self::$background_colors[$background_color] . "m";
$colored_string .= $string . "\033[0m";
return$colored_string;
}
staticfunctiongetForegroundColors() {
returnarray_keys(self::$foreground_colors);
}
staticfunctiongetBackgroundColors() {
returnarray_keys(self::$background_colors);
}
}