Skip to content

Instantly share code, notes, and snippets.

@yowcow
Last active January 27, 2017 10:05
Show Gist options
  • Save yowcow/6ee622cc9eda241ed84cd75c867ef435 to your computer and use it in GitHub Desktop.
Save yowcow/6ee622cc9eda241ed84cd75c867ef435 to your computer and use it in GitHub Desktop.
Shell Colors
#!/bin/bash
# Colors:
# 1: Red
# 2: Greed
# 3: Yellow
# 4: Blue
# 5: Magenta
# 6: Cyan
# 7: White
# 文字色を変える
echo -e "[\e[31m NG \e[m]"
echo -e "[\e[32m OK \e[m]"
# 背景色を変える
echo -e "[\e[41m NG \e[m]"
echo -e "[\e[42m OK \e[m]"
# 太字にする
echo -e "[\e[1m NG \e[m]"
# 下線を引く
echo -e "[\e[4m OK \e[m]"
# Blink する
echo -e "[\e[5m NG \e[m]"
# 反転する
echo -e "[\e[7m OK \e[m]"
# 混ぜる
echo -e "[\e[31;1m NG \e[m]"
echo -e "[\e[32;1m OK \e[m]"
echo -e "[\e[33;1m Skipped \e[m]"
# 変数にする
BOLD="1"
INVERT="7"
RED_FONT="31"
GREEN_FONT="32"
YELLOW_FONT="33"
BLUE_FONT="34"
RESET="\e[m"
FAILURE="\e[${BOLD};${RED_FONT}m"
SUCCESS="\e[${BOLD};${GREEN_FONT}m"
SKIP="\e[${YELLOW_FONT}m"
TODO="\e[${BOLD};${BLUE_FONT};${INVERT}m"
echo -en "[${FAILURE} Failed ${RESET}]"
echo -en "[${SUCCESS} Passed ${RESET}]"
echo -en "[${SKIP} Skipped ${RESET}]"
echo -en "[${TODO} Todo ${RESET}]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment