Terminal string styling done right -- with bash
Get a local copy by either:
- Add as submodule:
$ git submodule add https://github.com/sylvaindethier/chalk.sh.git
- Clone:
$ git clone https://github.com/sylvaindethier/chalk.sh.git
- Download the ZIP archive and unzip
Then source the chalk.sh/cli.sh
script:
$ source path/to/chalk.sh/cli.sh
chalk.sh
provides exactly the same CLI usage aschalk-cli
Make sure to source the chalk.sh/cli.sh
script before running chalk
$ chalk --help
Usage
$ chalk <style> ... <string>
$ echo <string> | chalk <style> ...
Options
--template, -t Style template. The `~` character negates the style.
Examples
$ chalk red bold 'Unicorns & Rainbows'
$ chalk -t '{red.bold Unicorns & Rainbows}'
$ chalk -t '{red.bold Dungeons and Dragons {~bold.blue (with added fairies)}}'
{red.bold unicorn}
{red.bold unicorns} are {blue FUN!!!}
{red.bold unicorn {blue.underline dancing}}
{red red {~red normal}}
{red hey\} still red} not red
{red hey\\} not red
MIT