Hacker News new | past | comments | ask | show | jobs | submit login

If someone wants to do this in Python, I made a lib for it: pip3 install ansi-escapes

It’s a port of sindresorhus’s ansi-escapes library. I find it way more convenient than looking up codes.

https://github.com/shawwn/ansi-escapes-python

It has some basic iTerm2 support too, so you can print out annotations in the console. Think of it like sticky notes.

See also ansi-styles, the lib that Chalk is based on. (Colors! You like colors? Are you a curmudgeony salt like me that refuses to use Rich for some reason? Use that.)

As with ansi-escapes, you can just pip install ansi-styles.

https://github.com/shawwn/ansi-styles-python




Aside: it’s so nice seeing a pyproject.toml these days.

It looks like we may be able to forego setup.cfg soon too. https://stackoverflow.com/a/64151860


Or you can use curses (or ncurses, or any other terminal-independent library) like an adult, and not create yet another “works best in iTerm” application. We’ve been down this road before, and we settled on curses and similar libraries to be terminal-independent.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: