Colored text output in PowerShell console using ANSI / VT100 codes

Note: The following applies to regular console windows on Windows (provided by conhost.exe), which are used by default, including when a console application is launched from a GUI application. By contrast, the console windows (terminals) provided by Windows Terminal as well as Visual Studio Code’s integrated terminal provide support for VT / ANSI escape sequences … Read more

ANSI Color Specific RGB Sequence Bash

Both answers here fail to mention the Truecolor ANSI support for 8bpc color. This will get the RGB color the OP originally asked for. Instead of ;5, use ;2, and specify the R, G, and B values (0-255) in the following three control segments. \x1b[38;2;40;177;249m To test if your terminal supports Truecolor: printf “\x1b[38;2;40;177;249mTRUECOLOR\x1b[0m\n” On … Read more

ANSI Coloring in Compilation Mode

There’s already a function for applying color to comint buffers. You simply need to enable it on compilation buffers: (require ‘ansi-color) (defun colorize-compilation-buffer () (toggle-read-only) (ansi-color-apply-on-region compilation-filter-start (point)) (toggle-read-only)) (add-hook ‘compilation-filter-hook ‘colorize-compilation-buffer) Color writing programs should check the TERM environment variable and the terminfo database to check if the terminal supports color. In practice, a … Read more

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

aha is a C-language program, available in an Ubuntu package, at http://ziz.delphigl.com/tool_aha.php or on github https://github.com/theZiz/aha, that takes an input with terminal colors by pipe or file and puts a (w3c conform) HTML-File in stdout. Example: ls –color=always | aha > ls-output.htm or ls –color=always | aha –black > ls-output.htm for a terminal-like look with … Read more

Removing colors from output

According to Wikipedia, the [m|K] in the sed command you’re using is specifically designed to handle m (the color command) and K (the “erase part of line” command). Your script is trying to set absolute cursor position to 60 (^[[60G) to get all the OKs in a line, which your sed line doesn’t cover. (Properly, … Read more

List of ANSI color escape sequences

The ANSI escape sequences you’re looking for are the Select Graphic Rendition subset. All of these have the form \033[XXXm where XXX is a series of semicolon-separated parameters. To say, make text red, bold, and underlined (we’ll discuss many other options below) in C you might write: printf(“\033[31;1;4mHello\033[0m”); In C++ you’d use std::cout<<“\033[31;1;4mHello\033[0m”; In Python3 … Read more

What are carriage return, linefeed, and form feed?

Carriage return means to return to the beginning of the current line without advancing downward. The name comes from a printer’s carriage, as monitors were rare when the name was coined. This is commonly escaped as “\r”, abbreviated CR, and has ASCII value 13 or 0xD. Linefeed means to advance downward to the next line; … Read more