Colors upgrade
This commit is contained in:
@@ -5,40 +5,53 @@ source colors.sh
|
||||
echo "-----------------------------------------------------------------------------"
|
||||
|
||||
# there can be a function that uses the colors
|
||||
function info() { printf "${MAGENTA}$@${NC}\n"; }
|
||||
function warn() { printf "${BOLD_YELLOW}$@${NC}\n"; }
|
||||
function error() { printf "${BOLD_RED}$@${NC}\n"; }
|
||||
function debug() { printf "${BOLD_GRAY}$@${NC}\n"; }
|
||||
function success() { printf "${BOLD_GREEN}$@${NC}\n"; }
|
||||
function info() { printf "${BOLD_CYAN}%s${NC}\n" "$@"; }
|
||||
function warn() { printf "${BOLD_YELLOW}%s${NC}\n" "$@"; }
|
||||
function error() { printf "${BOLD_RED}%s${NC}\n" "$@"; }
|
||||
function debug() { printf "${BOLD_GRAY}%s${NC}\n" "$@"; }
|
||||
function success() { printf "${BOLD_GREEN}%s${NC}\n" "$@"; }
|
||||
|
||||
info "This is a info test"
|
||||
warn "This is a warn test"
|
||||
error "This is a error test"
|
||||
debug "This is a debug test"
|
||||
info "[INFO] This is info text"
|
||||
warn "[WARN] This is warn text"
|
||||
error "[ERROR] This is error text"
|
||||
debug "[DEBUG] This is debug text"
|
||||
|
||||
echo "-----------------------------------------------------------------------------"
|
||||
|
||||
echo -e "${GRAY}-----------------------------------------------------------------------------${NC}"
|
||||
|
||||
## Color print function
|
||||
|
||||
function cprint() { printf "$1$2${NC}\n"; }
|
||||
cprint $RED "This is red text"
|
||||
cprint $BOLD_MAGENTA "Bold magenta text"
|
||||
cprint $BOLD_YELLOW "Bold yellow text"
|
||||
function color() { printf "$1%s${NC}\n" "$2";}
|
||||
color "$RED" "This is red text"
|
||||
color "$BOLD_MAGENTA" "Bold magenta text"
|
||||
color "$BOLD_YELLOW" "Bold yellow text"
|
||||
|
||||
echo "-----------------------------------------------------------------------------"
|
||||
echo -e "${GRAY}-----------------------------------------------------------------------------${NC}"
|
||||
|
||||
for color in $BLACK $GRAY $RED $GREEN $BLUE $YELLOW $MAGENTA $CYAN $WHITE; do
|
||||
printf "$color%s${NC}\n" "Test color text"
|
||||
done
|
||||
echo -e "${BLACK}Black color text${NC}"
|
||||
echo -e "${WHITE}White color text${NC}"
|
||||
|
||||
echo "-----------------------------------------------------------------------------"
|
||||
echo -e "${GRAY}-----------------------------------------------------------------------------${NC}\n\n"
|
||||
|
||||
# Basic colors
|
||||
|
||||
echo -e "${BLACK}BLACK${NC}, ${GRAY}GRAY${NC} or ${WHITE}WHITE${NC} color text"
|
||||
echo -e "${RED}RED${NC} or ${BRIGHT_RED}BRIGHT_RED${NC} color text"
|
||||
echo -e "${GREEN}GREEN${NC} or ${BRIGHT_GREEN}BRIGHT_GREEN${NC} color text"
|
||||
echo -e "${BLUE}BLUE${NC} or ${BRIGHT_BLUE}BRIGHT_BLUE${NC} color text"
|
||||
echo -e "${YELLOW}YELLOW${NC} or ${BRIGHT_YELLOW}BRIGHT_YELLOW${NC} color text"
|
||||
echo -e "${MAGENTA}MAGENTA${NC} or ${BRIGHT_MAGENTA}BRIGHT_MAGENTA${NC} color text"
|
||||
echo -e "${CYAN}CYAN${NC} or ${BRIGHT_CYAN}BRIGHT_CYAN${NC} color text"
|
||||
|
||||
|
||||
|
||||
echo -e "\n\n${GRAY}-----------------------------------------------------------------------------${NC}"
|
||||
|
||||
# with colors.sh sourced, you can use the constants
|
||||
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 -e "${RED}This is ${BOLD}bold red text${NC} and this is ${GREEN}green ${BLINK}blink${NC} text${NC}"
|
||||
echo -e "this is ${MAGENTA}magenta ${BLINK}blink${NC} text${NC}"
|
||||
|
||||
|
||||
echo "-----------------------------------------------------------------------------"
|
||||
echo -e "${GRAY}-----------------------------------------------------------------------------${NC}"
|
||||
|
||||
# Add color to the output of a command
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user