Questions tagged [ansi-escape]

ANSI escape code (or escape sequences) is the method of in-band signaling to control formatting, color, and other output options on video text terminals.

To encode this formatting information, it embeds certain sequences of bytes into the text, which have to be interpreted specially, not as codes of characters. Although hardware text terminals have become increasingly rare in the 21st century, the relevance of this standard persists because most terminal emulators interpret at least some of the ANSI escape sequences in the output text. One notable exception is the win32 console component of Microsoft Windows.

655 questions
962
votes
39 answers

How to change node.js's console font color?

I had to change the console background color to white because of eye problems, but the font is gray colored and it makes the messages unreadable. How can I change it?
MaiaVictor
  • 51,090
  • 44
  • 144
  • 286
646
votes
13 answers

What are carriage return, linefeed, and form feed?

What is the meaning of the following control characters: Carriage return Line feed Form feed
ashna
  • 7,159
  • 4
  • 20
  • 9
468
votes
9 answers

List of ANSI color escape sequences

On most terminals it is possible to colorize output using the \033 ANSI escape sequence. I'm looking for a list of all supported colors and options (like bright and blinking). As there are probably differences between the terminals supporting them,…
ThiefMaster
  • 310,957
  • 84
  • 592
  • 636
233
votes
21 answers

Removing colors from output

I have some script that produces output with colors and I need to remove the ANSI codes. #!/bin/bash exec > >(tee log) # redirect the output to a file but keep it on stdout exec 2>&1 ./somescript The output is (in log file): java (pid 12321)…
Pawel P.
  • 3,731
  • 4
  • 20
  • 20
134
votes
8 answers

How can I remove the ANSI escape sequences from a string in python

Here is a snippet that includes my string. 'ls\r\n\x1b[00m\x1b[01;31mexamplefile.zip\x1b[00m\r\n\x1b[01;31m' The string was returned from an SSH command that I executed. I can't use the string in its current state because it contains ANSI…
SpartaSixZero
  • 2,183
  • 5
  • 27
  • 46
93
votes
3 answers

A library to convert ANSI escapes (terminal formatting/color codes) to HTML

I'm looking for a code library that converts ANSI escape sequences into HTML color, via plain tags or CSS. For example, something that would convert…
Myrddin Emrys
  • 42,126
  • 11
  • 38
  • 51
88
votes
14 answers

How to make win32 console recognize ANSI/VT100 escape sequences in `c`?

I'm building a lightweight version of the ncurses library. So far, it works pretty well with VT100-compatible terminals, but win32 console fails to recognise the \033 code as the beginning of an escape sequence: # include # include…
Witiko
  • 3,167
  • 3
  • 25
  • 43
83
votes
6 answers

An Eclipse console view that respects ANSI color codes?

The output from ScalaTest is colored to distinguish different states, but these end up as control codes and [34m Annoying garbage Is there any way to convince the Eclipse console to either respect or ignore these sequences, or to plug in a view…
Duncan McGregor
  • 17,665
  • 12
  • 64
  • 118
55
votes
6 answers

ANSI Color Specific RGB Sequence Bash

I know that in bash terminals a reliable way to change color is using ANSI escape sequences. For example: echo -e "\033[0;31mbrown text\033[0;00m" should output brown text (in brown) Is there a way to output color using a specific RGB set with…
Blue Ice
  • 7,888
  • 6
  • 32
  • 52
54
votes
6 answers

ANSI Coloring in Compilation Mode

Have anyone added support for ansi-color in compilation-mode Emacs? If so what property/attribute does the color-writing program have to check for in order to make sure its active terminal supports ANSI-escape coloring.
Nordlöw
  • 11,838
  • 10
  • 52
  • 99
51
votes
4 answers

ANSI Color Codes in VIM

I have a script that generates a log file with ANSI color codes in them like so: [2012-05-14 18:00:02] ^[[0mINF: -- Starting update script --^[[0m [2012-05-14 18:00:29] ^[[91mERR: Improper date, entry being ignored.^[[0m Is there any way to get Vim…
Blake
  • 1,691
  • 2
  • 15
  • 23
49
votes
3 answers

Remove all ANSI colors/styles from strings

I use a library that adds ANSI colors / styles to strings. For example: > "Hello World".rgb(255, 255, 255) '\u001b[38;5;231mHello World\u001b[0m' > "Hello World".rgb(255, 255, 255).bold() '\u001b[1m\u001b[38;5;231mHello…
Ionică Bizău
  • 109,027
  • 88
  • 289
  • 474
48
votes
4 answers

Colored text output in PowerShell console using ANSI / VT100 codes

I wrote a program which prints a string, which contains ANSI escape sequences to make the text colored. But it doesn't work as expected in the default Windows 10 console, as you can see in the screenshot. The program output appears with the escape…
user2226112
47
votes
11 answers

Text editor/viewer with ANSI codes rendering support for Windows

I need some tool to display text containing ANSI codes correctly on Windows. No full support needed, but at least coloring/bold is a must. Reason: My logger/debug module produce nicely rendered rich output with important sections colored using ANSI…
SF.
  • 13,549
  • 14
  • 71
  • 107
43
votes
3 answers

How to detect if the console does support ANSI escape codes in Python?

In order to detect if console, correctly sys.stderr or sys.stdout, I was doing the following test: if hasattr(sys.stderr, "isatty") and sys.stderr.isatty(): if platform.system()=='Windows': # win code (ANSI not supported but there are…
sorin
  • 161,544
  • 178
  • 535
  • 806
1
2 3
43 44