diff --git a/example/usage.sh b/example/usage.sh index edabe36..cb2d6e7 100755 --- a/example/usage.sh +++ b/example/usage.sh @@ -2,7 +2,17 @@ source colors.sh -echo "-----------------------------------------------------------------------------" +# Basic colors + +echo -e "${GRAY}-----------------------------------------------------------------------------${NC}\n\n\n" +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\n${GRAY}-----------------------------------------------------------------------------${NC}" # there can be a function that uses the colors function info() { printf "${BOLD_CYAN}%s${NC}\n" "$@"; } @@ -16,7 +26,6 @@ warn "[WARN] This is warn text" error "[ERROR] This is error text" debug "[DEBUG] This is debug text" - echo -e "${GRAY}-----------------------------------------------------------------------------${NC}" ## Color print function @@ -28,25 +37,6 @@ color "$BOLD_YELLOW" "Bold yellow text" echo -e "${GRAY}-----------------------------------------------------------------------------${NC}" -echo -e "${BLACK}Black color text${NC}" -echo -e "${WHITE}White color text${NC}" - -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 -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}" @@ -57,6 +47,6 @@ echo -e "${GRAY}---------------------------------------------------------------- { echo "This is super text" echo "Every line will be prefixed with hostname and script name" - printf "${GREEN}This is green text${NC}\n" - printf "${RED}This is red text${NC}\n" + printf "${GREEN}%s${NC}\n" "This is green text" + printf "${RED}%s${NC}\n" "This is red text" } | awk '{printf "'${GRAY}[${HOSTNAME}'] ['$(basename "$0")']'${NC}' %s\n", $0; fflush(stdout)}' \ No newline at end of file