/** * Test all bright colors... * * @depends test_class_defined */ public function test_foreground_bright_colors() { $this->assertEquals("[1;30m", ansi::Black()); $this->assertEquals("[1;31m", ansi::Red()); $this->assertEquals("[1;32m", ansi::Green()); $this->assertEquals("[1;33m", ansi::Yellow()); $this->assertEquals("[1;34m", ansi::Blue()); $this->assertEquals("[1;35m", ansi::Magenta()); $this->assertEquals("[1;36m", ansi::Cyan()); $this->assertEquals("[1;37m", ansi::White()); }
echo PHP_EOL; echo "Calling colors without arguments yields only the color code," . PHP_EOL; echo "which remains active until you output another color or use" . PHP_EOL; echo "ansi::restore, or ansi::reset." . PHP_EOL; echo PHP_EOL; $simple_colors = array(ansi::red(), ansi::green(), ansi::yellow(), ansi::blue(), ansi::magenta(), ansi::cyan(), ansi::white()); foreach ($simple_colors as $c) { echo $c . "Simple color simple color simple color simple color" . PHP_EOL; } echo ansi::reset(); $bright_colors = array(ansi::RED(), ansi::GREEN(), ansi::YELLOW(), ansi::BLUE(), ansi::MAGENTA(), ansi::CYAN(), ansi::WHITE()); foreach ($bright_colors as $c) { echo $c . "Bright color bright color bright color bright color" . PHP_EOL; } echo ansi::reset(); $composite_colors = array(ansi::White_on_red(), ansi::White_on_green(), ansi::Black_on_yellow(), ansi::White_on_blue(), ansi::Blue_on_magenta(), ansi::Black_on_cyan(), ansi::red_on_white()); foreach ($composite_colors as $c) { echo $c . "Background colors background colors background color" . ansi::reset() . PHP_EOL; } echo ansi::reset(); echo PHP_EOL; echo "Redefine custom colors for a more semantic usage: " . PHP_EOL; echo ansi::White("ansi::define('error', 'White_on_red')") . " ====> "; echo ansi::White("ansi::error('Yup! Something was wrong!')") . PHP_EOL; echo PHP_EOL; echo ansi::Green("Colors are automatically stripped when piped!!") . PHP_EOL; echo "Use '" . ansi::White("php examples.php | less") . "' to test." . PHP_EOL; echo PHP_EOL; echo "See documentation at " . ansi::BLUE("http://github.com/twoixter/ansicolors") . PHP_EOL; echo "for more information." . PHP_EOL; echo PHP_EOL;