Giter Club home page Giter Club logo

bash_colors's Introduction

Bash colors

The library defines verbal constants for ANSII color codes.
Now you can use words to tell bash what color you want to use for output.

Also, it defines functions to quickly output colored text.
As well as the function to display nice table of all colors.

Examples

Print "foobar" with red foreground.

$ clr_red "foobar"

Print "foobar" with green background.

$ clr_greenb "foobar"

Print "foobar" with cyan foreground and bold font.

$ clr_bold "$(clr_cyan foobar)"

or manually, using variables

$ clr_escape "foobar" $CLR_BOLD $CLR_CYAN

or any other code

clr_escape "foobar" 1 36

Quick start

  1. Download source
$ curl https://raw.github.com/maxtsepkov/bash_colors/master/bash_colors.sh > .bash_colors
  1. Load into your script
$ source .bash_colors

Variables

$CLR_*

Variables for each supported color code. E.g. $CLR_WHITE, $CLR_BLACK
Call clr_dump for full list.

$CLR_ESC
is a special variable for escape code (\033) followed by [ character.

Functions

clr_dump
Output table of available colors, functions and variables.

clr_* string
Functions for each supported color. E.g. clr_white, clr_black
See clr_dump for list.

clr_escape string $CLR ...
escape string with given colors. Latest colors overwrites previous.

clr_reset
Reset formatting. Useful for custom usage of $CLR_* variable series.

See also

console_codes(4)
Advanced Bash Scripting Guide

bash_colors's People

Contributors

kofalt avatar web3promax avatar

Watchers

 avatar  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.