App-ansiecho
view release on metacpan or search on metacpan
[](https://github.com/tecolicom/App-ansiecho/actions) [](https://metacpan.org/release/App-ansiecho)
# NAME
ansiecho - Colored echo command using ANSI terminal sequence
# SYNOPSIS
ansiecho \[ options \] args ...
Command Options:
-n Do not print the trailing newline
-j --join Do not print space between arguments
-e --escape Enable backslash escape notation
--rgb24 Produce 24bit color sequence
--separate=s Set argument separator
-h --help Print this message
-v --version Print version
Prefix Options:
-s/-S SPEC Produce ANSI sequence(s)
-c/-C SPEC ARG Colorize next argument(s)
-f/-F FORMAT ARGS Format arguments
-E Terminate -C -S -F effect
-i/-a SPEC Insert/Append ANSI sequence
Example:
ansiecho -c R Red -c M/551 Magenta/Yellow -c FSDB BlinkReverseBoldBlue
âcolorââ âcolorâââââââââââââââââ âcolorââââââââââââââââââââââ
ansiecho -f '[ %12s ]' -c SR -f '%+06d' 123
â â âformatâââââââ
â âcolorââââââââââââââ
âformatâââââââââââââââââââââââââââ
ansiecho -C '555/(132,0,41)' d i g i t a l
âcolorâââââââââââââââââââââââââââ
read -a color < <( ansiecho -S ZE K/544 K/454 K/445 )
âsequenceââââââââââââââ
<div>
<p><img width="750" src="https://raw.githubusercontent.com/kaz-utashiro/App-ansiecho/main/images/synopsis.png">
</div>
# VERSION
Version 1.0702
# DESCRIPTION
## ECHO
**ansiecho** print arguments with ANSI terminal escape sequence
according to a given color and format specification.
In a simple case, **ansiecho** behave exactly same as [echo](https://metacpan.org/pod/echo) command.
ansiecho a b c
Like [echo](https://metacpan.org/pod/echo) command, option **-n** disables to print newline at the
end. Option **-j** (or **--join**) removes white space between
arguments.
Arguments can include backslash escaped characters, such as `\n` for
a new line. There is an bash-echo-compatible **-e** option, but it is
enabled by default. You can include control and named Unicode
characters using this.
ansiecho '\t\N{ALARM CLOCK}\a'
See ["STRING LITERAL"](#string-literal) section for detail.
## COLOR and EFFECT
You can specify color of each argument by preceding with **-c** option:
ansiecho -c R foo -c GI bar -c BD baz
This command print strings `foo`, `bar` and `baz` according to the
color spec of `R` (Red), `GI` (_Green Italic_) and `BD` (**Blue
Bold**) respectively.
Foreground and background color is specified in the form of
`fore/back`.
ansiecho -c B/M 'Blue on Magenta' -c '<pink>/<salmon>' fish
Color can be described by 8+8 standard colors, 24 gray scales, 6x6x6
216 colors, RGB values or color names, with special effects such as I
(Italic), D (Double-struck; Bold), S (Stand-out; Reverse Video) and
such. More information is described in ["COLOR SPEC"](#color-spec) section.
## FORMAT
Format string can be specified by **-f** option, and it behaves like a
[printf(1)](http://man.he.net/man1/printf) command.
ansiecho -f '[ %5s : %5s : %5s ]' -c R RED -c G GREEN -c B BLUE
As in above example, colored text can be given as an argument for
**-f** option, and the string width is calculated as you expect,
including multibyte Unicode characters.
( run in 5.414 seconds using v1.01-cache-2.11-cpan-c221a9de4ec )