WP-CLI

A command line interface for WordPress

Docs » Internal API » Output

WP_CLI::colorize()

Colorize a string for output.


Usage

WP_CLI::colorize( $string )
$string (string) String to colorize for output, with color tokens.
@return (string) string.

Notes

Yes, you too can change the color of command line text. For instance, here’s how WP_CLI::success() colorizes “Success: “

WP_CLI::colorize( "%GSuccess:%n " )

Uses \cli\Colors::colorize() to transform color tokens to display settings. Choose from the following tokens (and note ‘reset’):

Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.