Questions tagged [ansi]
55 questions
14
votes
1 answer
What type of encoding do these ANSI artworks use?
I've found this website; it has zip files (links on the main page) with all the artworks. Some of them have an .ans extension and they look like ANSI escape codes used on Linux/Unix, but when I open one of them using cat in the XFce terminal it…
jcubic
- 9,612
- 16
- 54
- 75
7
votes
3 answers
how to use 256 colors for background color in terminal
I know how to use 256 colors for text in terminal:
printf "\033[38;5;196mhello\n"
But for background color, I seem to be limited to the basic 8 colors only, ie:
printf "\033[41mhello\n"
How can I use 256 colors for background colors as well ?
I…
400 the Cat
- 819
- 4
- 37
- 85
6
votes
2 answers
leave color in stdout but remove from tee
I want to see color output when in stdout to the console, but I want to remove it in a captured copy of the output from the tee command.
In my case,
command_that_writes_color_to_stdout | tee file
I'd like the file to be clean of ANSI color…
johnnyB
- 183
- 5
6
votes
3 answers
How to convert escape sequences to text while preserving display format?
I have a text file that contains (ANSI ?) escape sequences:
When I cat the file I get formatted output:
How do I save / pipe the output of the text file to a new file so that the control codes are removed but the formatting is preserved?
In other…
mvanle
- 275
- 2
- 7
4
votes
1 answer
What is the ANSI escape equivalent of `tput sgr0`?
To avoid a subshell, what are the ANSI escape equivalents of tput sgr0 for an ANSI-compatible terminal?
Tom Hale
- 28,728
- 32
- 139
- 229
3
votes
2 answers
How can I save a text file with all command line inputs and outputs without saving the ANSI characters?
I am running the latest mac OS and using zshell, and having trouble writing a shell script. I do most of my work from the command line, and wanted to have a bash script automatically save and log all of my input commands and output.
My most obvious…
Nicole I.
- 31
- 1
3
votes
0 answers
What is the meaning of ESC ( B ANSI escape code?
I'm working on the ANSI escape codes interpreter and I have this escape code from the top command.
[K
[7m PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND (B[m[39;49m[K
(B[m 23805…
jcubic
- 9,612
- 16
- 54
- 75
3
votes
1 answer
Why this ANSI Art doesn't render properly on Linux terminal
I'm trying to investigate why my library don't render this ANSI art properly:
I though that the problem is in my ANSI escape processing but it seems that it's the same in real terminal (tested in XFce terminal).
I have no idea how to debug this,…
jcubic
- 9,612
- 16
- 54
- 75
2
votes
1 answer
How to display rgb hex colors on terminal using python?
Using ANSI escape sequence, I can change the color of text that python prints. The example below prints "Hi World" in light blue.
#!/usr/bin/python3
print(f'\033[38;5;117mHi World')
While this works I am limited to just 256 colors. Are there any…
un31389
- 21
- 2
2
votes
2 answers
In this \033[01;32m VT100 style ANSI Escape Sequences what is the 01; and the m?
This came from ~/.bashrc
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
Notice the \033[01;32m
I know \033[ is a Control Sequence Introducer.
I know 32 is the color code for green.
But,…
Sameh Ramzy Labib
- 113
- 6
1
vote
1 answer
i3 status bar with ANSI *input*
I want to show a text having ANSI escape sequences in a status bar.
The status text is generated by third party tools, that manage themselves the ANSI colors (and hyperlinks, albeit these may be left apart). The status bar is to be displayed in the…
nojhan
- 111
- 4
1
vote
1 answer
How to print logs in color with repetitive call to a function which configs the color?
I want to print logs with colored keywords. Previously I used:
cd ~/Code/Docker/somerepo && docker-compose logs -f my_service \
| grep -v "Successfully connected" \
| grep -v "this operation breaks ==" \
| sed "s/at com\.example\.product/at…
WesternGun
- 414
- 1
- 6
- 15
1
vote
0 answers
Is it possible to restore the cursor style in a terminal?
It's possible, with ANSI codes, to modify the cursor shape (block, underscore or line) and whether it's blinking or not.
My program is doing just that. But, is it possible to get the cursor style so it can be restored later (when my program…
Cl00e9ment
- 111
- 2
1
vote
0 answers
How to animate progress without overwriting other output?
Let's say I'm writing a program in Go that runs for a period of time while using ANSI control codes to animate a progress indicator line. For example,
outer:
for {
select {
case <-ticker:
fmt.Printf("\033[%dF\033[J",…
Sean
- 11
- 1
1
vote
1 answer
How to know the end of an ANSI control code?
I'm working on code for a serial terminal and I'm implementing the ANSI escape codes for moving around the cursor, clearing the screen, etc, and I am curious how to know which to use since there doesn't seem to be a clear stopping point for the…
Gregory
- 53
- 4