PHP code example of localgod / console-color

1. Go to this page and download the library: Download localgod/console-color 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/ */

    

localgod / console-color example snippets


use Localgod\Console\Color;
// Let's add a little color to the world
// %n resets the color so the following stuff doesn't get messed up
print Color::convert("%bHello World!%n\n");
// Paint it red
print Color::redNormal("Paint it red!\n");
// Colorless mode, in case you need to strip colorcodes off a text
print Color::convert("%rHello World!%n\n", false);
// The uppercase version makes a colorcode bold/bright
print Color::convert("%BHello World!%n\n");
// To print a %, you use %%
print Color::convert("3 out of 4 people make up about %r75%% %nof the world population.\n");
// Or you can use the escape() method.
print Color::convert("%y".Color::escape('If you feel that you do everying wrong, be random, there\'s a 50% Chance of making the right decision.')."%n\n");