Giter VIP home page Giter VIP logo

php-cli_colors's Introduction

PHP-CLI Colors

If you use PHP for anything command-line related, you've probably wanted colors at some point.
Now you can! The easy way!

This handy include files contains a miriad of color defines, along with some sample functions to make colorizing text easy.

Usage

include_once('colors.inc.php');
echo CLEAR;
echo TXTRED . "Hello Red World!" . TXTRST . PHP_EOL;
echo green("Hello Green World!") . PHP_EOL;

For a full list of colors, consult the include file itself.
To sample the colors, change FALSE to TRUE in the include and run it standalone.

Notes

Using colorized text inside of printf calls is not recommended. (string length !== visible length)
Using colorized text inside of files is not recommended.
On some setups, the colors may appear somewhat differently. This is most notable with the bold vs regular colorsets.
If the colored text fails to render, it's not you. It's your console.

Works and tested with PuTTY and Cygwin.

Colors in action

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.