From f7bfdf58def6aadc922e1632f407d1418269a0d7 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Sat, 9 Jul 2022 19:40:17 +0300 Subject: initial --- engine/ansi.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 engine/ansi.php (limited to 'engine/ansi.php') diff --git a/engine/ansi.php b/engine/ansi.php new file mode 100644 index 0000000..311c837 --- /dev/null +++ b/engine/ansi.php @@ -0,0 +1,34 @@ +value + ($fg_bright ? 90 : 30); + if (!is_null($bg)) + $codes[] = $bg->value + ($bg_bright ? 100 : 40); + if ($bold) + $codes[] = 1; + + if (empty($codes)) + return $text; + + return "\033[".implode(';', $codes)."m".$text."\033[0m"; +} \ No newline at end of file -- cgit v1.2.3