GithubHelp home page GithubHelp logo

aelliott1485 / php-chalk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tdtrung17693/php-chalk

0.0 0.0 0.0 38 KB

A small PHP library for terminal output styling

License: Apache License 2.0

PHP 100.00%

php-chalk's Introduction

PHP Chalk

A PHP terminal styling library inspired by Chalk

Features

  • Support 16 colors, 256 colors and Truecolor (16m colors) mode.
  • Support style chaining.
  • Support style nesting.

Installation

Through composer

composer require tdtrung17693/php-chalk

Manually:

Just download/clone this repo

Usage

See examples to know more about how to use this library.

print $chalk->bold->green("Bold Green");
print "\n";
print $chalk->underscore->color220->bgColor20("Blink Foreground 220 Background 20");
print "\n";
print $chalk->rgb(200, 20, 100)->inverse("Inverse");

// Style nesting
print $chalk->red("Red then", $chalk->bold->green("bold and green then"), $chalk->reset("back to normal\n"));

Screenshot:

Examples

Color blocks

API

$chalk-><style>[-><style>...](string, [string...])

Example: $chalk->bgGreen->red->bold('Background green red bold text')

$chalk->hasColorSupport(), $chalk->has256Support(), $chalk->has16mSupport()

Return true if the corresponding feature is supported.

Styles supported

  • reset, bold, dim, underscore, italic, strikethrough, blink.
  • red, green, yellow, blue, magenta, cyan, white
  • lightGray, darkGray, lightRed, lightGreen, lightYellow, lightBlue, lightMagenta, lightCyan
  • Each of the color styles above with the prefix bg

Contribute

Feel free to contribute by forking or making suggestions.

php-chalk's People

Contributors

tdtrung17693 avatar

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.