ANSI Escape Codes Explained
cwoebker.com
ANSI Escape Codes Explained
1–10 of 18 posts
Re: ANSI Escape Codes Explained
#2Re: ANSI Escape Codes Explained
#3Re: ANSI Escape Codes Explained
#4You're probably better off reading the Wikipedia article:
https://en.wikipedia.org/wiki/ANSI_escape_code
Some of the much more interesting codes are the ones that control cursor positioning and redrawing, and are used to create ASCII UIs by libraries like ncurses & readline, and programs like vim & tmux.
I've written a rudimentary chat interface using native ANSI code, which was quite a bit trickier than it looks, but a fun exercise. The tricky part was ensuring that an interactive line of input remained at the bottom of the screen, while the chat room history keeps scrolling above[1].
https://github.com/ChartBoost/zmq-examples/blob/master/chat/...
[1]: of course, if you're actually building something for production, don't be an idiot like me and use a real library like ncurses.
Re: ANSI Escape Codes Explained
#5"cls.ESCAPE % cls.BOLD % cls.UNDERLINE % cls.COLOR['white']"?
Seriously? The "+" operator does the exact same thing in this case and is easier to read. I can forgive the typos in the article, but teaching others with poor code? That is less easy to forgive. If the original author reads this, please take the time to revise the article, the code, and resubmit.
Re: ANSI Escape Codes Explained
#6Re: ANSI Escape Codes Explained
#7Re: ANSI Escape Codes Explained
#8I was a little disappointed by the explanation – I was expecting this to dive deep into how ANSI code came to be, and how they worked. Not just "hey they exist and are neat." You're probably better off reading the Wikipedia article: https://en.wikipedia.org/wiki/ANSI_escape_code Some of the much more interesting codes are the ones that control cursor positioning and redrawing, and are used to create ASCII UIs by libr…
http://vt100.net/docs/vt100-ug/
Note that this doesn't include all VT100 escape codes supported by modern terminals, but it is the basis for how they all work.
Re: ANSI Escape Codes Explained
#9Re: ANSI Escape Codes Explained
#10Weak explanation and crummy code. It didn't answer one of my long standing ansi escape code questions: whats the deal with that 256 (really 216) color space that programs like htop use? How do I get that, and why does it exist? Also: "cls.ESCAPE % cls.BOLD % cls.UNDERLINE % cls.COLOR['white']"? Seriously? The "+" operator does the exact same thing in this case and is easier to read. I can forgive the typos in the art…