65 lines
1.6 KiB
PHP
65 lines
1.6 KiB
PHP
|
<?php
|
||
|
|
||
|
class Color {
|
||
|
const RESET = "\033[0m";
|
||
|
const BOLD = "\033[1m";
|
||
|
const UNDERLINE = "\033[4m";
|
||
|
const INVERSE = "\033[7m";
|
||
|
const BLACK = "\033[30m";
|
||
|
const RED = "\033[31m";
|
||
|
const GREEN = "\033[32m";
|
||
|
const YELLOW = "\033[33m";
|
||
|
const BLUE = "\033[34m";
|
||
|
const MAGENTA = "\033[35m";
|
||
|
const CYAN = "\033[36m";
|
||
|
const WHITE = "\033[37m";
|
||
|
|
||
|
private static function format(string $color, string $string): string {
|
||
|
return $color . $string . self::RESET;
|
||
|
}
|
||
|
|
||
|
public static function bold(string $string): string {
|
||
|
return self::format(self::BOLD, $string);
|
||
|
}
|
||
|
|
||
|
public static function underline(string $string): string {
|
||
|
return self::format(self::UNDERLINE, $string);
|
||
|
}
|
||
|
|
||
|
public static function inverse(string $string): string {
|
||
|
return self::format(self::INVERSE, $string);
|
||
|
}
|
||
|
|
||
|
public static function black(string $string): string {
|
||
|
return self::format(self::BLACK, $string);
|
||
|
}
|
||
|
|
||
|
public static function red(string $string): string {
|
||
|
return self::format(self::RED, $string);
|
||
|
}
|
||
|
|
||
|
public static function green(string $string): string {
|
||
|
return self::format(self::GREEN, $string);
|
||
|
}
|
||
|
|
||
|
public static function yellow(string $string): string {
|
||
|
return self::format(self::YELLOW, $string);
|
||
|
}
|
||
|
|
||
|
public static function blue(string $string): string {
|
||
|
return self::format(self::BLUE, $string);
|
||
|
}
|
||
|
|
||
|
public static function magenta(string $string): string {
|
||
|
return self::format(self::MAGENTA, $string);
|
||
|
}
|
||
|
|
||
|
public static function cyan(string $string): string {
|
||
|
return self::format(self::CYAN, $string);
|
||
|
}
|
||
|
|
||
|
public static function white(string $string): string {
|
||
|
return self::format(self::WHITE, $string);
|
||
|
}
|
||
|
}
|