Simple colors for your bash scripts
Go to file
2023-04-05 17:53:30 +02:00
example First commit 2023-04-05 17:50:56 +02:00
colors.png First commit 2023-04-05 17:50:56 +02:00
colors.sh First commit 2023-04-05 17:50:56 +02:00
LICENSE First commit 2023-04-05 17:50:56 +02:00
readme.md Center image 2023-04-05 17:53:30 +02:00

colors.sh

Write colored text to the terminal easily.

Color palette

Installation

Download colors.sh and source it in your script or copy/paste the functions and variables into your script.

Usage

source colors.sh

# with colors.sh sourced, you can use the constants
echo "${RED}This is red text${NC}"

# or you can use the functions
echo $(gray "[INFO] " && green "This is green test")

Functions

  • gray - for gray
  • light_gray - for light gray
  • yellow - for yellow
  • light_yellow - for light yellow
  • green - for green
  • light_green - for light green
  • red - for red
  • ligt_red - for ligt red
  • blue - for blue
  • light_blue - for light blue
  • magenta - for magenta
  • light_magenta - for light magenta
  • cyan - for cyan
  • white - for white
  • black - for black
  • bold - for bold
  • underline - for underline
  • blink - for blink text
  • nc - for no colors (reset)

Contants

  • GRAY - for gray
  • LIGHT_GRAY - for light_gray
  • YELLOW - for yellow
  • LIGHT_YELLOW - for light yellow
  • GREEN - for green
  • LIGHT_GREEN - for light green
  • RED - for red
  • LIGHT_RED - for light red
  • BLUE - for blue
  • LIGHT_BLUE - for light blue
  • MAGENTA - for magenta
  • LIGHT_MAGENTA - for light magenta
  • CYAN - for cyan
  • WHITE - for white
  • BLACK - for black
  • BOLD - for bold
  • UNDERLINE - for underline
  • BLINK - for blink
  • NC - for no colors (reset)