From 8405455ca54313c8f7ec9d90a5e83c033f325326 Mon Sep 17 00:00:00 2001 From: Dominic Reich Date: Sat, 24 Aug 2024 16:48:04 +0200 Subject: [PATCH] adds ansi_colors.py --- ansi_colors.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 ansi_colors.py diff --git a/ansi_colors.py b/ansi_colors.py new file mode 100755 index 0000000..91029f6 --- /dev/null +++ b/ansi_colors.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +# Found on: https://stackoverflow.com/a/33206814 +# You may not have a binary called `python3` so you can also run this script like so: +# $ python3.11 ~/bin/ansi_colors.py + +for i in range(30, 37 + 1): + print("\033[%dm%d\t\t\033[%dm%d" % (i, i, i + 60, i + 60)) + +print("\033[39m\\033[49m - Reset color") +print("\\033[2K - Clear Line") +print("\\033[;H or \\033[;f - Put the cursor at line L and column C.") +print("\\033[A - Move the cursor up N lines") +print("\\033[B - Move the cursor down N lines") +print("\\033[C - Move the cursor forward N columns") +print("\\033[D - Move the cursor backward N columns\n") +print("\\033[2J - Clear the screen, move to (0,0)") +print("\\033[K - Erase to end of line") +print("\\033[s - Save cursor position") +print("\\033[u - Restore cursor position\n") +print("\\033[4m - Underline on") +print("\\033[24m - Underline off\n") +print("\\033[1m - Bold on") +print("\\033[21m - Bold off")