Questions tagged [ansi-colors]

109 questions
2487
votes
51 answers

How to print colored text to the terminal?

How can I output colored text to the terminal in Python?
aboSamoor
  • 25,055
  • 3
  • 15
  • 10
46
votes
6 answers

How to use the ANSIcolor plugin in Jenkins?

I have installed the ANSI-color plugin for Jenkins. In the Jobs I have activated that plugin with the default profile 'xterm'. I cannot figure out how to colorize the output of the Console Log when printing to the log from the batch files…
Stefan Schroeder
  • 601
  • 1
  • 5
  • 10
39
votes
8 answers

Is there an easy way to COLOR-CODE the compiler outputs?

gcc (or other compilers) often generate huge text output and it's very difficult to see where the error is or miss warnings. I've done some search but havn't found a clean simple solution to color code the compiler output (so for instance warnings…
Ann Brown
  • 445
  • 1
  • 4
  • 5
22
votes
3 answers

Html to ansi colored terminal text

I am under Linux and I want to fetch an html page from the web and then output it on terminal. I found out that html2text essentially does the job, but it converts my html to a plain text whereas I would better convert it into ansi colored text in…
Sergey
  • 221
  • 2
  • 4
22
votes
4 answers

Getting correct string length in Python for strings with ANSI color codes

I've got some Python code that will automatically print a set of data in a nice column format, including putting in the appropriate ASCII escape sequences to color various pieces of the data for readability. I eventually end up with each line being…
Paul D.
  • 1,575
  • 2
  • 16
  • 24
22
votes
4 answers

Can't enable 256 colors in ConEmu

I'm trying to get 256 colors in the fantastic ConEmu-Maximus5 console. Update: Now it only shows 8 colors. I know because '$tput colors' output is '8' I have followed the instructions and activated: TrueMod (24-bit color) support Inject…
RafaelGP
  • 1,539
  • 4
  • 19
  • 31
21
votes
4 answers

Where to put the wrapper for ansiColor Jenkins plugin in Jenkins Pipeline?

I'm unsure of what to do with declarative jenkins pipeline. Following the example here: https://github.com/jenkinsci/ansicolor-plugin wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) { sh 'something that outputs ansi colored…
Eric Francis
  • 18,369
  • 25
  • 77
  • 118
21
votes
2 answers

RGB values of the colors in the Ansi extended colors index (17-255)

My question is in general shell scripting with ansi colors but for reference I am using an Apple Mac OS X 10.9 Mavericks. I use "iTerm" terminal app as my default terminal but also checked with the built in "terminal" app as well. I use ZSH (5.0.7)…
Jim Knecht
  • 245
  • 2
  • 9
15
votes
1 answer

Logback: use colored output only when logging to a real terminal

In my Logback configuration I have the following lines: %highlight(...) %msg%n
doublep
  • 25,014
  • 8
  • 67
  • 82
14
votes
2 answers

emacs strips away all ansi color codes in shells

I'm using emacs 24 on OS X and have the strange problem that I'm unable to see any color codes. Emacs seems to just ignore them. My motivation is to see colored output from cmake, llvm and the googletest framework for a C++ project. I'd like to see…
jupp0r
  • 4,163
  • 26
  • 33
14
votes
2 answers

output of [31m text instead of color

I am trying to print coloured text with colorama but when I compile an exe and run following... from colorama import Fore, Back, Style print(Fore.RED + 'text') print(Back.GREEN + 'and with a green background') print(Style.DIM + 'and in dim…
user8900239
14
votes
1 answer

How do I get clang to dump the AST without color?

Using clang-check to dump a source code's AST, can be done with the following command: $ clang-check -ast-dump file.c -- However, the output of this command will appear colorful within the terminal. When I direct the output to a file, I'm stuck…
Trevor Hickey
  • 31,728
  • 22
  • 131
  • 236
13
votes
3 answers

how to get current terminal color pair in bash

I would like to query and store the current terminal color pair in BASH e.g.: #!/bin/bash #some ANSI colour escape sequences red="\033[0;31m" grn="\033[0;32m" blu="\033[0;34m" def="\033[0;00m" # default echo -e "Change to ${red} red to ${def}…
ubundom
  • 133
  • 1
  • 7
13
votes
2 answers

Python’s `str.format()`, fill characters, and ANSI colors

In Python 2, I’m using str.format() to align a bunch of columns of text I’m printing to a terminal. Basically, it’s a table, but I’m not printing any borders or anything—it’s simply rows of text, aligned into columns. With no color-fiddling,…
Zearin
  • 1,288
  • 2
  • 15
  • 32
9
votes
3 answers

How to correctly enable ANSI colors in ConEmu + Git Bash?

I'm using Git Bash with ConEmu to make it look cool. However, upon installing Composer the colors seem to be escaped: So Git Bash does not support all the colors. Checking the AnsiColors256.ans file: After lots of Googling, I still haven't found…
gpap
  • 123
  • 1
  • 8
1
2 3 4 5 6 7 8