Cli Colors

Colors are added to cli texts for different reasons. Mostly, they either provide quick information on a particular subject matter or they are used to keep console users alert and aware of responses obtained from running a particular command. They can also be used to separate different syntaxes to a particular command but the most important use of colors is that they make console texts more readable and easier to process.

Cli colors are added to text through the use of color codes. Each text is wrapped within its own color code, making it impossible to add colors within another color code whether as a combination of text colors or text background colors. This in other words mean that each text color must be defined separately for each texts. The available methods under these category are listed below:

Cli::color()
This method is used to apply colors on cli texts. There are four basic text colors support which are green, yellow, blue and red. Colors are added by wrapping texts within the specific color code. The technology is based on the fact that a color code cannot be applied within another color code. Hence, to apply diffent color codes on texts, each text must be wrapped separately within its own color.

Syntax
    Cli::color($text, $name, $spacing); 
    
      where: 
    
        $text    : The text on which color should be applied
        $name    : The name of color to be applied. Options are [red|blue|green|yellow|cyan|purple]
        $spcaing : An optional spacing format
    
                                    

Cli::danger()
This method is a short form of applying a red color code on texts.

Syntax
    Cli::danger($text, $spacing); 
    
      where: 
    
        $text    : The text on which color should be applied
        $spacing : An optional spacing format
    
                                    

Cli::warn()
This method is a short form of applying a yellow color code on texts.

Syntax
    Cli::warn($text, $spacing); 
    
      where: 
    
        $text    : The text on which color should be applied
        $spacing : An optional spacing format
    
                                    

Cli::alert()
This method is a short form of applying a blue color code on texts.

Syntax
    Cli::alert($text, $spacing); 
    
      where: 
    
        $text    : The text on which color should be applied
        $spacing : An optional spacing format
    
                                    

Cli::valid()
This method is a short form of applying a green color code on texts.

Syntax
    Cli::valid($text, $spacing); 
    
      where: 
    
        $text    : The text on which color should be applied
        $spacing : An optional spacing format
    
                                    

Cli::bgColor()
This method is a used to apply background colors on texts. It is however important to lay emphasis on the fact that both the bgColor() and the color() methods cannot be applied within each other but can only be applied separately on different texts.

Syntax
    Cli::bgColor($text, $name, $spacing); 
    
      where: 
    
        $text    : The text on which color should be applied
        $name    : The background color name to be applied. Options: [white|black|red|green|blue|cyan|purple|yellow] 
        $spacing : An optional spacing format
    
                                    

Cli::bgDanger()
This method is a short form of applying a red background color code on texts.

Syntax
    Cli::bgDanger($text, $spacing); 
    
      where: 
    
        $text    : The text on which background color should be applied
        $spacing : An optional spacing format
    
                                    

Cli::bgWarn()
This method is a short form of applying a yellow background color code on texts.

Syntax
    Cli::warn($text, $spacing); 
    
      where: 
    
        $text    : The text on which background color should be applied
        $spacing : An optional spacing format
    
                                    

Cli::bgAlert()
This method is a short form of applying a blue color code on texts.

Syntax
    Cli::bgAlert($text, $spacing); 
    
      where: 
    
        $text    : The text on which background color should be applied
        $spacing : An optional spacing format
    
                                    

Cli::bgValid()
This method is a short form of applying a green color code on texts.

Syntax
    Cli::bgValid($text, $spacing); 
    
      where: 
    
        $text    : The text on which background color should be applied
        $spacing : An optional spacing format