Skip to content

Instantly share code, notes, and snippets.

@joallard
Last active March 8, 2018 22:07
Show Gist options
  • Save joallard/b98408634b298d5f0bfe4f067ebbda60 to your computer and use it in GitHub Desktop.
Save joallard/b98408634b298d5f0bfe4f067ebbda60 to your computer and use it in GitHub Desktop.
Shell ANSI escape sequences in Ruby (iTerm title, colors)
# <https://en.wikipedia.org/wiki/ANSI_escape_code>
# iTerm: Set title to 'foo'
puts "\e]0;Foo\a"
# equiv to
# puts "\033]0;Foo\007"
# Print 'foo' in green and reset
puts "\e[32;mfoo\e[0m boo"
# <https://en.wikipedia.org/wiki/ANSI_escape_code#Colors>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment