Created
July 24, 2012 15:24
-
-
Save rmcastil/3170644 to your computer and use it in GitHub Desktop.
Playing with VT100 Codes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# printf "\033[0mAll attributes off\033[0m\n" | |
# printf "\033[1mBold\033[0m\n" | |
# printf "\033[4mUnderline\033[0m\n" | |
# printf "\033[5mBlink\033[0m\n" | |
# printf "\033[8mHide\033[0m\n" | |
# printf "\033[30mBlack\033[0m\n" | |
# printf "\033[31mRed\033[0m\n" | |
# printf "\033[32mGreen\033[0m\n" | |
# printf "\033[33mYellow\033[0m\n" | |
# printf "\033[34mBlue\033[0m\n" | |
# printf "\033[35mMagenta\033[0m\n" | |
# printf "\033[36mCyan\033[0m\n" | |
# printf "\033[37mWhite\033[0m\n" | |
# printf "\033[40m\033[37mBlack Background\033[0m\n" | |
# printf "\033[41mRead Background\033[0m\n" | |
# printf "\033[42mGreen Background\033[0m\n" | |
# printf "\033[43mYellow Background\033[0m\n" | |
# printf "\033[44mBlue Background\033[0m\n" | |
# printf "\033[45mMagenta Background\033[0m\n" | |
# printf "\033[46mCyan Background\033[0m\n" | |
# printf "\033[47mWhite Background\033[0m\n" | |
system("clear") | |
symbols = ['|', '/', '-', '\\'] | |
count = 0 | |
# [s saves the cursor position | |
#print "\033[s" | |
2.times do | |
symbols.each do |sym| | |
# [u unsave cursor (returns the cursor position | |
#print "\033[u\033[1D" | |
# Hide the cursor | |
print "\033[?25l" | |
# Sets the cursor position | |
print "\033[20;20H" | |
print "\033[34m#{sym}\033[0m" | |
#print "\033[s\033[0;0f" | |
STDOUT.flush | |
sleep 0.5 | |
end | |
end | |
print "\033[u" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment