App-ansiecho
view release on metacpan or search on metacpan
- **-f** _format_ _args_ ...
Print _args_ in a given _format_. Backslash escape is always
interpreted in the format string.
The result of **-f** sequence ends up to a single argument, and can be
a subject of other **-c** or **-f** option.
Number of arguments are calculated from the number of `%` characters
in the format string except `%%`. Variable width and precision
parameter `*` can be used like `%*s` or `%*.*s`.
Format string also can be made by **-f** option. Next commands produce
same output, but second one looks better.
ansiecho -f -f '%%%ds' 16 hello
ansiecho -f '%*s' 16 hello
- **-S** _spec_
If option `-S` found, all following arguments are considered as a
color spec given to **-s** option, until option **-E** is found.
Next two commands are equivalent.
ansiecho -s ZE -s K/544 -s K/454 -s K/445
ansiecho -S ZE K/544 K/454 K/445
- **-C** _spec_
Option **-C** set permanent color which is applied to all following
arguments until option **-E** found.
Next command prints only a word `Yellow` in yellow, but second one
print `Yellow`, `Brick`, and `Road` in yellow.
ansiecho Follow the -cYS Yellow Brick Road
ansiecho Follow the -CYS Yellow Brick Road
You may want to color the phrase instead.
ansiecho Follow the -cYS "Yellow Brick Road"
Option `-C` can be used multiple times mixed with `-F` option. See
below.
- **-F** _format_
As with the `-C` option, `-F` defines a format which is applied to
all arguments until option **-E** found. Format string have to include
single `%s` placeholder.
ansiecho Follow the -CYS -F ' %s ' Yellow Brick Road
Option **-C** and **-F** can be used repeatedly, and they will take
effect in the reverse order of their appearance.
Next command show argument `A` in underline/bold with blinking red
arrow.
ansiecho -cRF -f'->%s' -cUD A B C
Next one does the same thing for all arguments.
ansiecho -CRF -F'->%s' -CUD A B C
â â â
- **-E**
Terminate **-C**, **-F** and **-S** effects.
- **-i** _spec_
- **-a** _spec_
Add raw ANSI sequence given by _spec_. Option **-i** insert the
sequence before the next argument, while **-a** append to the final
argument.
Next two commands are equivalent.
ansiecho -c R Red
ansiecho -i R Red -a ZE
Color spec `ZE` produces RESET and ERASE LINE sequence.
Because **-i** and **-a** does not produce RESET sequence, you can use
them to accumulate the effects.
ansiecho -i R R -i U RU -i I RUI -i S RUIS -i F RUISF -a Z
# STRING LITERAL
This is a backslash escape samples described in ["Quote and
Quote-like Operators" in perlop](https://metacpan.org/pod/perlop#Quote-and-Quote-like-Operators). Non-alphabetical character after backslash is
always correspond to the character itself.
Sequence Description
\t tab (HT, TAB)
\n newline (NL)
\r return (CR)
\f form feed (FF)
\b backspace (BS)
\a alarm (bell) (BEL)
\e escape (ESC)
\x{263A} hex char (example: SMILEY)
\x1b restricted range hex char (example: ESC)
\N{name} named Unicode character or character sequence
\N{U+263D} Unicode character (example: FIRST QUARTER MOON)
\c[ control char (example: chr(27))
\o{23072} octal char (example: SMILEY)
\033 restricted range octal char (example: ESC)
# COLOR SPEC
This is a brief summary. Read ["COLOR SPEC" in Term::ANSIColor::Concise](https://metacpan.org/pod/Term%3A%3AANSIColor%3A%3AConcise#COLOR-SPEC) for
complete description. Try next command to see 256 color table.
perl -MTerm::ANSIColor::Concise::Table=:all -E colortable
Color specification is a combination of single uppercase character
representing 8 colors, and alternative (usually brighter) colors in
lowercase :
R r Red
G g Green
B b Blue
C c Cyan
M m Magenta
Y y Yellow
K k Black
W w White
or RGB values and 24 grey levels if using ANSI 256 or full color
terminal :
(255,255,255) : 24bit decimal RGB colors
#000000 .. #FFFFFF : 24bit hex RGB colors
#000 .. #FFF : 12bit hex RGB 4096 colors
000 .. 555 : 6x6x6 RGB 216 colors
L00 .. L25 : Black (L00), 24 grey levels, White (L25)
or color names enclosed by angle bracket :
<red> <blue> <green> <cyan> <magenta> <yellow>
<aliceblue> <honeydew> <hotpink> <moccasin>
<medium_aqua_marine>
with other special effects :
N None
Z 0 Zero (reset)
D 1 Double strike (boldface)
P 2 Pale (dark)
I 3 Italic
U 4 Underline
F 5 Flash (blink: slow)
Q 6 Quick (blink: rapid)
S 7 Stand out (reverse video)
H 8 Hide (concealed)
X 9 Cross out
E Erase Line
; No effect
/ Toggle foreground/background
^ Reset to foreground
~ Cancel following effect
Samples:
RGB 6x6x6 12bit 24bit color name
=== ======= ========= ============= ==================
B 005 #00F (0,0,255) <blue>
/M /505 /#F0F /(255,0,255) /<magenta>
K/W 000/555 #000/#FFF 000000/FFFFFF <black>/<white>
R/G 500/050 #F00/#0F0 FF0000/00FF00 <red>/<green>
W/w L03/L20 #333/#ccc 303030/c6c6c6 <dimgrey>/<lightgrey>
# 256/24BIT COLORS
12bit/24bit colors are converted to 216 colors because most terminal
can not display them. On some terminals which set the environment
variable `COLORTERM` as `truecolor` (e.g. iTerm), 24bit color mode
is automatically enabled. Otherwise, use **--rgb24** option or set
`GETOPTEX_RGB24` environment variable to produce full-color sequence.
# INSTALL
## CPANMINUS
From CPAN archive:
cpanm App::ansiecho
From GIT repository:
cpanm https://github.com/kaz-utashiro/App-ansiecho.git
# SEE ALSO
["Quote and Quote-like Operators" in perlop](https://metacpan.org/pod/perlop#Quote-and-Quote-like-Operators)
[Term::ANSIColor::Concise](https://metacpan.org/pod/Term%3A%3AANSIColor%3A%3AConcise)
[https://en.wikipedia.org/wiki/ANSI\_escape\_code](https://en.wikipedia.org/wiki/ANSI_escape_code)
[Graphics::ColorNames::X](https://metacpan.org/pod/Graphics%3A%3AColorNames%3A%3AX)
[https://en.wikipedia.org/wiki/X11\_color\_names](https://en.wikipedia.org/wiki/X11_color_names)
[App::ansifold](https://metacpan.org/pod/App%3A%3Aansifold), [App::ansicolumn](https://metacpan.org/pod/App%3A%3Aansicolumn)
( run in 1.572 second using v1.01-cache-2.11-cpan-99c4e6809bf )