PHP code example of krypt0nn / colorizer

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

    

krypt0nn / colorizer example snippets




use Colorizer\Colors;

echo 'Hello, '. Colors::yellow () .'World'. Colors::reset () .'!';



use Colorizer\Color;

echo 'Hello, '. new Color ('yellow') .'World'. new Color ('reset') .'!';



use Colorizer\Colors;

echo Colors::format ('Hello, [yellow]World[reset]!');



use Colorizer\Colors;

echo Colors::format ('[red,0,1][white]                                            
    [yellow,1]WARNING![white]                                
    Something went wrong                    
                                            [reset]');



use Colorizer\Dialog;

echo (new Dialog ('Something went wrong', 'WARNING!'))
    ->background ('red')
    ->foregroundCaption ('yellow')
    ->width (30);



use Colorizer\Dialog;

echo Dialog::new ('Something went wrong', 'WARNING!')
    ->background ('red')
    ->foregroundCaption ('yellow')
    ->width (30);