Questions tagged [ansi]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3 votes
1 answer
83 views

How can I pipe text that contains ANSI movement characters ESC[xC and ESC[xD and output the text formatted accodingly

I have text files that include the ANSI movement codes ESC[xC and ESC[xD. I want to filter these out but with each line output with those codes taken into account. Consider the line: this cat is ...
Scott's user avatar
  • 33
1 vote
1 answer
314 views

How to configure ANSI text colors for NixOS console?

I'm on NixOS-unstable (as of 2023 Oct 1st). How can I configure the text colors for the default NixOS console, as the terminal supports ANSI? I tested what the colors look like by installing text-ansi ...
Dannyu NDos's user avatar
0 votes
1 answer
148 views

Why do terminals report their background color as rgb:xxxx/yyyy/zzzz — what format is that?

If I set my terminal background to the color #1a2b3c and then query it with printf '\e]11;?\a' I get back ]11;rgb:1a74/2b98/3cb6 What encoding are these supposed values of red 1a74 , green 2b98 , and ...
balupton's user avatar
  • 471
2 votes
1 answer
898 views

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 ...
un31389's user avatar
  • 21
3 votes
2 answers
1k views

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 ...
Nicole I.'s user avatar
0 votes
1 answer
170 views

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 ...
nojhan's user avatar
  • 109
-1 votes
1 answer
125 views

ircII ansi escape sequences

REHASH from my original question. I'm trying to get VT100/ANSI escape codes working in an irc client (ircII). What facilitates this, is the screen.scr file. The apparent problem, is that I cannot get ...
ignatius's user avatar
  • 401
1 vote
1 answer
224 views

ANSI escape sequences in PS1 cause incorrect length calculation [duplicate]

I have a PS1 set up in my .zshrc which includes multiple ANSI escape sequences. An equivalent definition works nicely in Bash, but in Zsh (v5.8.1) it seemingly causes the shell to calculate the width ...
Konrad Rudolph's user avatar
0 votes
0 answers
193 views

Color Code Specific Words/Phrases in a Unix/Linux Terminal Regardless of the Command Used that Prints that Word/Phrase

Is there a way in Unix/Linux to always color-code specific words/phrases no matter what made those words/phrases appear as output on the terminal? I know you can write scripts/programs to print out ...
Sacred's user avatar
  • 1
0 votes
1 answer
271 views

How does `tput` detect color support

I am trying to make my shell script supporting as much terminals as possible, that is, adding ANSI colors, bold and dim only when supported. However, I want to detect the number of colors supported. ...
sudoer's user avatar
  • 45
0 votes
3 answers
226 views

Linux 9 commands send ANSI/color sequences to monochrome terminal

I'm using a Wyse50 Terminal emulation on Rocky Linux 9. Man pages, help screens, etc., are unusable because the system outputs attribute and color codes that the terminal emulator doesn't understand;...
Darrel Barton's user avatar
0 votes
3 answers
339 views

How to interpret \e[H\e[2J ANSI escapes sequence from Linux terminal?

I'm asking again the question that was asked on StackOverflow with no answers I event added a bounty without an effect (I've just deleted that one). I think that people here may have better knowledge ...
jcubic's user avatar
  • 9,962
3 votes
0 answers
345 views

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 ...
jcubic's user avatar
  • 9,962
1 vote
1 answer
62 views

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 &...
WesternGun's user avatar
2 votes
0 answers
266 views

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 ...
Cl00e9ment's user avatar
0 votes
2 answers
148 views

How do I preserve vimcat colors in a pipe?

For example, this will preserve ls's coloring / syntax highlighting: ls -la --color=always | egrep --color=always -i "(foobar|$)" But this will not (so I know it's not a grep issue): vimcat ...
Jonathan Wheeler's user avatar
11 votes
2 answers
4k views

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 ...
johnnyB's user avatar
  • 243
-1 votes
2 answers
258 views

terminal-emulator settings controlling the rendering of bold typeface

The effect of bold typeface (ANSI: CSI 1 m) seems to depend on the terminal emulator. For example, running the following script on different terminal emulators #!/bin/sh echo "TERM = $TERM" ...
user001's user avatar
  • 3,698
1 vote
0 answers
150 views

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 &...
Sean's user avatar
  • 11
0 votes
1 answer
275 views

Saving ANSI codes from dialog command into a file

Is it possible to get dialog command, example: dialog --title "HELLO" --yesno "Are you sure?" 6 30 into a file with all ANSI escape codes, so it can be printed later? You can ...
jcubic's user avatar
  • 9,962
0 votes
0 answers
205 views

how to parse output ANSI code from script file (scriptreplay)

I'm trying to understand how script log file works So I can implement it in jQuery Terminal to play script files. I've found this JavaScript library. Didn't test it only looked at the code that is ...
jcubic's user avatar
  • 9,962
0 votes
1 answer
627 views

BASH ANSI-C Quoting - what is the Escape character \E

According to the GNU Bash manual (section 3.1.2.4 ANSI-C Quoting) $'\E' should expand to "an escape character (not ANSI C)". What is this escape character? Is it the character equivalent to ...
Lavya's user avatar
  • 1,605
1 vote
1 answer
296 views

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'...
Gregory's user avatar
  • 53
0 votes
1 answer
132 views

Problematic [0;5;30m ANSI Code in ANSI Art

I have another question about ANSI Art. The problem is this file https://16colo.rs/pack/lgcy-003/hayn9-smaller.ans It have "à" character (the women in ANSI Art have it inside medalion on her ...
jcubic's user avatar
  • 9,962
7 votes
3 answers
4k views

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 ...
mvanle's user avatar
  • 335
0 votes
0 answers
47 views

Behavior of ANSI escape codes when mixing background and foreground [duplicate]

I'm investigating once more my ANSI escape rendering scripts and I've found weird behavior. The output color is defined by background or foreground by both mixed together. Example: echo -e "\x1b[...
jcubic's user avatar
  • 9,962
-1 votes
1 answer
290 views

Difference between ANSI art and Linux Terminal ANSI escapes codes

I just found one ANSI escape that is different in ANSI art and in Linux Terminal. [0;5;47;30m The problem is this ANSI Art https://16colo.rs/pack/blocktronics-b-sides/om%20-%20bjork%20-%20debut.ans ...
jcubic's user avatar
  • 9,962
1 vote
1 answer
218 views

Missing one character in ANSI art on Linux

This continuation of Why this ANSI Art doesn't render properly on Linux terminal I have one more issue with ANSI art on Linux terminal that renders properly in ANSI art editor (like PabloDraw). The ...
jcubic's user avatar
  • 9,962
3 votes
1 answer
817 views

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 ...
jcubic's user avatar
  • 9,962
7 votes
3 answers
6k views

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&...
Martin Vegter's user avatar
1 vote
1 answer
2k views

Scrolling terminal up using ANSI escape codes

I'm trying to create a simple terminal program that can "scroll up" to see text that has been written to the terminal (but has since moved off the screen). I can use the ANSI escape code \...
inersha's user avatar
  • 111
3 votes
2 answers
3k views

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 ...
Sameh Ramzy Labib's user avatar
1 vote
0 answers
128 views

Avoid ANSI codes in bash prompt when using arrow keys

First of all, aw two things to make clear: Yes I've seen there are already several questions with a similar sounding headline, but they are neither talking about the same situation nor do they have a ...
Max's user avatar
  • 11
1 vote
2 answers
994 views

What ANSI escape 0x1b[0A and other 0 value codes should do?

I working on my ANSI formatting code for jQuery Terminal. It almost working but I have one issue it's related to 0A ansi code that should move cursor (also other 0 cursor codes: B C D E F) I've ...
jcubic's user avatar
  • 9,962
0 votes
0 answers
59 views

Bashrc not loading when running manpager

I have found issues with using the MANPAGER variable in bash in order to set vim to be my manpager. Initially I set my manpager using the method shown in :help manpager by doing: export MANPAGER="...
kabeersvohra's user avatar
0 votes
1 answer
3k views

What should ASCII character 26 do?

I have code where I display ANSI art, I've found that last 128 bytes hold SAUCE meta data. The problem I have is just before the SAUCE data there is one character that looks out of place, that is ...
jcubic's user avatar
  • 9,962
-4 votes
1 answer
233 views

What is the 38;5 sequence in $PS1?

I tried to find info online, but I could not find any. It seems that many people use a specific sequence of numbers, without actually providing any explanation why. More specifically, my $PS1 in ...
Xxxo's user avatar
  • 118
1 vote
1 answer
2k views

What's the correct way to use ANSI escape sequences to edit terminal content "in place"?

So I'm trying to have a simple terminal application with the following behavior: On launch, the screen is cleared, and some content is written at the top of the empty screen Every time "enter" is ...
sak's user avatar
  • 193
0 votes
0 answers
68 views

How do I add characters to the ANSI terminal so that the user can move their cursor through them?

Specifically, I want to do something like this: aaaaaaaa_ Where the cursor can move through the as.
kkeey's user avatar
  • 111
1 vote
0 answers
185 views

How to fix HOME and END buttons in Bash with ANSI prompt? [duplicate]

In bash, whenever I have a prompt with ANSI color codes, it messes up the HOME and END functionality. Is there an obvious fix for this? To re-create: PS1="\e[0;33m\u@\e[m $ " echo "This is a very ...
JoshuaDavid's user avatar
0 votes
1 answer
2k views

Bash - ANSI color code for purple background with bold black text

What is the ANSI color code for a purple (or dark purple) background with black bold text (foreground). As an example, here is cyan with black bold text: echo -e "\e[30;1;46mExample\e[0m" After ...
Sophie's user avatar
  • 845
0 votes
1 answer
667 views

How to "echo" colored messages without "-e" option nor intermediate variable?

I really struggle understanding the behavior of echo (and others such commands) while processing ANSI escape codes to print colored messages. I know I can use the -e option like this: echo -e "\e[...
Delgan's user avatar
  • 161
1 vote
1 answer
2k views

Clearing a line when terminal window is narrowed

Consider the following code (written in PHP, but that's not important. Answers may use pure Bash). The goal is to fill a terminal line with characters for the entire width of the line. Now, if you ...
forthrin's user avatar
  • 2,289
1 vote
2 answers
3k views

Display ANSI colours with curl?

I'm currently trying to curl some raw text and have it displayed with interpreted ANSI colours in the Terminal. Currently, when I run curl http://example.com/test.txt (not the actual URL), it simply ...
Rocco's user avatar
  • 263
1 vote
2 answers
3k views

How can I make ANSI RGB color codes bold?

I've been learning how to customize my prompt with colors. I understand that you can define red text with \e[0;31m and define an RGB color (in the following example, R=255, G=95, B=255) as \e[38;2;...
Trevor's user avatar
  • 1,649
0 votes
1 answer
1k views

Changing the color of colored outputs

My terminal has a white background. When commands print yellow text to the terminal, I can't see the text clearly (due to low contrast). I thought: wouldn't it be great if all the yellow text that ...
Flux's user avatar
  • 2,938
14 votes
1 answer
3k views

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 ...
jcubic's user avatar
  • 9,962
5 votes
1 answer
6k views

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's user avatar
  • 30.5k
-1 votes
1 answer
283 views

How to change colors as user in Redhat linux server (iterm2, ssh)

My school server is Redhat 7.4 and I really hate the default colors which are printed in ls. bold and dark colors with a black backround is really hard for me to see any file names. I am currently ...
Joona's user avatar
  • 1
0 votes
0 answers
243 views

Bash: print invisible timestamp in PS1

My current PS1 looks like this: ╭dotfiles ╰(ivan)• I'd like to add an invisible timestamp to it, so I can select/highlight it with the cursor when I want to see what time a command ran, but not ...
ivan's user avatar
  • 1,878