Skip to content

Instantly share code, notes, and snippets.

@gcao
Created February 23, 2011 21:06
Show Gist options
  • Save gcao/841188 to your computer and use it in GitHub Desktop.
Save gcao/841188 to your computer and use it in GitHub Desktop.
terminal colors
#!/usr/bin/ruby
printf "\033[0m0 All attributes off\033[0m\n"
printf "\033[1m1 Bold\033[0m\n"
printf "\033[4m4 Underline\033[0m\n"
printf "\033[5m5 Blink\033[0m\n"
printf "\033[7m7 Invert\033[0m\n"
printf "\033[8m8 Hide\033[0m = Hide\n"
printf "\033[30m30 Black\033[0m = Black\n"
printf "\033[31m31 Red\033[0m\n"
printf "\033[32m32 Green\033[0m\n"
printf "\033[33m33 Yellow\033[0m\n"
printf "\033[34m34 Blue\033[0m\n"
printf "\033[35m35 Magenta\033[0m\n"
printf "\033[36m36 Cyan\033[0m\n"
printf "\033[37m37 White\033[0m\n"
printf "\033[40m\033[37m40 Black Background\033[0m\n"
printf "\033[41m41 Red Background\033[0m\n"
printf "\033[42m42 Green Background\033[0m\n"
printf "\033[43m43 Yellow Background\033[0m\n"
printf "\033[44m44 Blue Background\033[0m\n"
printf "\033[45m45 Magenta Background\033[0m\n"
printf "\033[46m46 Cyan Background\033[0m\n"
printf "\033[47m47 White Background\033[0m\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment