PHP code example of rxx / colors

1. Go to this page and download the library: Download rxx/colors library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rxx / colors example snippets


public static function cprint($msg, $appendNewline = true, $autoReset = true, $return = false)



use RXX\Colors\Colors;

// basic usage
Colors::cprint('%b;various %c;shades %B;of %C;blue');
Colors::cprint('%Rw;red on white');

// bars in blue and red
Colors::cprint('%kB;     %x;     %kR;     ');

// returning a string, without newline
$bright = Colors::cprint('%Y;YELLOW!', false, true, true);
echo "bright '{$bright}'\n";

// continuing color without reset
Colors::cprint('w listing in bright green on blue:%Gb;', true, false);
system('w');

// print newline and reset
Colors::cprint('');