Remove functions
This commit is contained in:
@@ -6,42 +6,25 @@
|
|||||||
# License: MIT
|
# License: MIT
|
||||||
|
|
||||||
# Define Colors
|
# Define Colors
|
||||||
GRAY='\033[0;90m'
|
export GRAY='\033[0;90m'
|
||||||
LIGHT_GRAY='\033[0;90m'
|
export LIGHT_GRAY='\033[0;90m'
|
||||||
YELLOW='\033[0;33m'
|
export YELLOW='\033[0;33m'
|
||||||
LIGHT_YELLOW='\033[0;93m'
|
export LIGHT_YELLOW='\033[0;93m'
|
||||||
GREEN='\033[0;32m'
|
export GREEN='\033[0;32m'
|
||||||
LIGHT_GREEN='\033[0;92m'
|
export LIGHT_GREEN='\033[0;92m'
|
||||||
RED='\033[0;31m'
|
export RED='\033[0;31m'
|
||||||
LIGHT_RED='\033[0;91m'
|
export LIGHT_RED='\033[0;91m'
|
||||||
BLUE='\033[0;34m'
|
export BLUE='\033[0;34m'
|
||||||
LIGHT_BLUE='\033[0;94m'
|
export LIGHT_BLUE='\033[0;94m'
|
||||||
MAGENTA='\033[0;35m'
|
export MAGENTA='\033[0;35m'
|
||||||
LIGHT_MAGENTA='\033[0;95m'
|
export LIGHT_MAGENTA='\033[0;95m'
|
||||||
CYAN='\033[0;36m'
|
export CYAN='\033[0;36m'
|
||||||
WHITE='\033[0;37m'
|
export WHITE='\033[0;37m'
|
||||||
BLACK='\033[0;30m'
|
export BLACK='\033[0;30m'
|
||||||
|
|
||||||
# Styles
|
# Styles
|
||||||
|
|
||||||
BOLD='\033[1m'
|
export BOLD='\033[1m'
|
||||||
UNDERLINE='\033[4m'
|
export UNDERLINE='\033[4m'
|
||||||
BLINK='\033[5m'
|
export BLINK='\033[5m'
|
||||||
NC='\033[0m' # no Color
|
export NC='\033[0m' # no Color
|
||||||
|
|
||||||
# Define Functions
|
|
||||||
function gray() { printf "${GRAY}%s${NC}" "$@"; }
|
|
||||||
function light_gray() { printf "${LIGHT_GRAY}%s${NC}" "$@"; }
|
|
||||||
function yellow() { printf "${YELLOW}%s${NC}" "$@"; }
|
|
||||||
function light_yellow() { printf "${LIGHT_YELLOW}%s${NC}" "$@"; }
|
|
||||||
function green() { printf "${GREEN}%s${NC}" "$@"; }
|
|
||||||
function light_green() { printf "${LIGHT_GREEN}%s${NC}" "$@"; }
|
|
||||||
function red() { printf "${RED}%s${NC}" "$@"; }
|
|
||||||
function light_red() { printf "${LIGHT_RED}%s${NC}" "$@"; }
|
|
||||||
function blue() { printf "${BLUE}%s${NC}" "$@"; }
|
|
||||||
function light_blue() { printf "${LIGHT_BLUE}%s${NC}" "$@"; }
|
|
||||||
function magenta() { printf "${MAGENTA}%s${NC}" "$@"; }
|
|
||||||
function light_magenta() { printf "${LIGHT_MAGENTA}%s${NC}" "$@"; }
|
|
||||||
function cyan() { printf "${CYAN}%s${NC}" "$@"; }
|
|
||||||
function white() { printf "${WHITE}%s${NC}" "$@"; }
|
|
||||||
function black() { printf "${BLACK}%s${NC}" "$@"; }
|
|
||||||
|
|||||||
+1
-5
@@ -6,15 +6,11 @@ source colors.sh
|
|||||||
echo "${RED}This is red text${NC} and this is ${GREEN}green ${BLINK}blink${NC} text${NC}"
|
echo "${RED}This is red text${NC} and this is ${GREEN}green ${BLINK}blink${NC} text${NC}"
|
||||||
echo "this is ${MAGENTA}magenta ${BLINK}blink${NC} text${NC}"
|
echo "this is ${MAGENTA}magenta ${BLINK}blink${NC} text${NC}"
|
||||||
|
|
||||||
# or you can use the functions
|
|
||||||
echo $(gray "[INFO] " && green "This is green test")
|
|
||||||
|
|
||||||
# there can be a function that uses the colors
|
# there can be a function that uses the colors
|
||||||
function info() { echo $(gray "[INFO] " && yellow "$@"); }
|
function info() { printf "${YELLOW}$@${NC}\n"; }
|
||||||
info "This is a info test"
|
info "This is a info test"
|
||||||
|
|
||||||
# or you can use the functions directly
|
# or you can use the functions directly
|
||||||
|
|
||||||
printf "${GRAY}GRAY${NC}\n"
|
printf "${GRAY}GRAY${NC}\n"
|
||||||
printf "${LIGHT_GRAY}LIGHT_GRAY${NC}\n"
|
printf "${LIGHT_GRAY}LIGHT_GRAY${NC}\n"
|
||||||
printf "${YELLOW}YELLOW${NC}\n"
|
printf "${YELLOW}YELLOW${NC}\n"
|
||||||
|
|||||||
@@ -8,37 +8,19 @@ Write colored text to the terminal easily.
|
|||||||
|
|
||||||
Download `colors.sh` and source it in your script or copy/paste the functions and variables into your script.
|
Download `colors.sh` and source it in your script or copy/paste the functions and variables into your script.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
curl -O https://raw.githubusercontent.com/OzzyCzech/colors.sh/master/colors.sh
|
||||||
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
source colors.sh
|
source colors.sh
|
||||||
|
|
||||||
# with colors.sh sourced, you can use the constants
|
# with colors.sh sourced, you can use the constants
|
||||||
echo "${RED}This is red text${NC}"
|
echo "This is ${RED}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
|
|
||||||
- `nc` - for no colors (reset)
|
|
||||||
|
|
||||||
## Contants
|
## Contants
|
||||||
|
|
||||||
- `GRAY` - for gray
|
- `GRAY` - for gray
|
||||||
|
|||||||
Reference in New Issue
Block a user