1Term::ANSIColor(3) User Contributed Perl Documentation Term::ANSIColor(3)
2
3
4
6 Term::ANSIColor - Color screen output using ANSI escape sequences
7
9 use Term::ANSIColor;
10 print color('bold blue');
11 print "This text is bold blue.\n";
12 print color('reset');
13 print "This text is normal.\n";
14 print colored("Yellow on magenta.", 'yellow on_magenta'), "\n";
15 print "This text is normal.\n";
16 print colored(['yellow on_magenta'], 'Yellow on magenta.', "\n");
17 print colored(['red on_bright_yellow'], 'Red on bright yellow.', "\n");
18 print colored(['bright_red on_black'], 'Bright red on black.', "\n");
19 print "\n";
20
21 # Map escape sequences back to color names.
22 use Term::ANSIColor 1.04 qw(uncolor);
23 my $names = uncolor('01;31');
24 print join(q{ }, @{$names}), "\n";
25
26 # Strip all color escape sequences.
27 use Term::ANSIColor 2.01 qw(colorstrip);
28 print colorstrip("\e[1mThis is bold\e[0m"), "\n";
29
30 # Determine whether a color is valid.
31 use Term::ANSIColor 2.02 qw(colorvalid);
32 my $valid = colorvalid('blue bold', 'on_magenta');
33 print "Color string is ", $valid ? "valid\n" : "invalid\n";
34
35 # Create new aliases for colors.
36 use Term::ANSIColor 4.00 qw(coloralias);
37 coloralias('alert', 'red');
38 print "Alert is ", coloralias('alert'), "\n";
39 print colored("This is in red.", 'alert'), "\n";
40
41 use Term::ANSIColor qw(:constants);
42 print BOLD, BLUE, "This text is in bold blue.\n", RESET;
43
44 use Term::ANSIColor qw(:constants);
45 {
46 local $Term::ANSIColor::AUTORESET = 1;
47 print BOLD BLUE "This text is in bold blue.\n";
48 print "This text is normal.\n";
49 }
50
51 use Term::ANSIColor 2.00 qw(:pushpop);
52 print PUSHCOLOR RED ON_GREEN "This text is red on green.\n";
53 print PUSHCOLOR BRIGHT_BLUE "This text is bright blue on green.\n";
54 print RESET BRIGHT_BLUE "This text is just bright blue.\n";
55 print POPCOLOR "Back to red on green.\n";
56 print LOCALCOLOR GREEN ON_BLUE "This text is green on blue.\n";
57 print "This text is red on green.\n";
58 {
59 local $Term::ANSIColor::AUTOLOCAL = 1;
60 print ON_BLUE "This text is red on blue.\n";
61 print "This text is red on green.\n";
62 }
63 print POPCOLOR "Back to whatever we started as.\n";
64
66 This module has two interfaces, one through color() and colored() and
67 the other through constants. It also offers the utility functions
68 uncolor(), colorstrip(), colorvalid(), and coloralias(), which have to
69 be explicitly imported to be used (see "SYNOPSIS").
70
71 See "COMPATIBILITY" for the versions of Term::ANSIColor that introduced
72 particular features and the versions of Perl that included them.
73
74 Supported Colors
75 Terminal emulators that support color divide into three types: ones
76 that support only eight colors, ones that support sixteen, and ones
77 that support 256. This module provides the ANSI escape codes for all
78 of them. These colors are referred to as ANSI colors 0 through 7
79 (normal), 8 through 15 (16-color), and 16 through 255 (256-color).
80
81 Unfortunately, interpretation of colors 0 through 7 often depends on
82 whether the emulator supports eight colors or sixteen colors.
83 Emulators that only support eight colors (such as the Linux console)
84 will display colors 0 through 7 with normal brightness and ignore
85 colors 8 through 15, treating them the same as white. Emulators that
86 support 16 colors, such as gnome-terminal, normally display colors 0
87 through 7 as dim or darker versions and colors 8 through 15 as normal
88 brightness. On such emulators, the "normal" white (color 7) usually is
89 shown as pale grey, requiring bright white (15) to be used to get a
90 real white color. Bright black usually is a dark grey color, although
91 some terminals display it as pure black. Some sixteen-color terminal
92 emulators also treat normal yellow (color 3) as orange or brown, and
93 bright yellow (color 11) as yellow.
94
95 Following the normal convention of sixteen-color emulators, this module
96 provides a pair of attributes for each color. For every normal color
97 (0 through 7), the corresponding bright color (8 through 15) is
98 obtained by prepending the string "bright_" to the normal color name.
99 For example, "red" is color 1 and "bright_red" is color 9. The same
100 applies for background colors: "on_red" is the normal color and
101 "on_bright_red" is the bright color. Capitalize these strings for the
102 constant interface.
103
104 For 256-color emulators, this module additionally provides "ansi0"
105 through "ansi15", which are the same as colors 0 through 15 in sixteen-
106 color emulators but use the 256-color escape syntax, "grey0" through
107 "grey23" ranging from nearly black to nearly white, and a set of RGB
108 colors. The RGB colors are of the form "rgbRGB" where R, G, and B are
109 numbers from 0 to 5 giving the intensity of red, green, and blue. The
110 grey and RGB colors are also available as "ansi16" through "ansi255" if
111 you want simple names for all 256 colors. "on_" variants of all of
112 these colors are also provided. These colors may be ignored completely
113 on non-256-color terminals or may be misinterpreted and produce random
114 behavior. Additional attributes such as blink, italic, or bold may not
115 work with the 256-color palette.
116
117 There is unfortunately no way to know whether the current emulator
118 supports more than eight colors, which makes the choice of colors
119 difficult. The most conservative choice is to use only the regular
120 colors, which are at least displayed on all emulators. However, they
121 will appear dark in sixteen-color terminal emulators, including most
122 common emulators in UNIX X environments. If you know the display is
123 one of those emulators, you may wish to use the bright variants
124 instead. Even better, offer the user a way to configure the colors for
125 a given application to fit their terminal emulator.
126
127 Function Interface
128 The function interface uses attribute strings to describe the colors
129 and text attributes to assign to text. The recognized non-color
130 attributes are clear, reset, bold, dark, faint, italic, underline,
131 underscore, blink, reverse, and concealed. Clear and reset (reset to
132 default attributes), dark and faint (dim and saturated), and underline
133 and underscore are equivalent, so use whichever is the most intuitive
134 to you.
135
136 Note that not all attributes are supported by all terminal types, and
137 some terminals may not support any of these sequences. Dark and faint,
138 italic, blink, and concealed in particular are frequently not
139 implemented.
140
141 The recognized normal foreground color attributes (colors 0 to 7) are:
142
143 black red green yellow blue magenta cyan white
144
145 The corresponding bright foreground color attributes (colors 8 to 15)
146 are:
147
148 bright_black bright_red bright_green bright_yellow
149 bright_blue bright_magenta bright_cyan bright_white
150
151 The recognized normal background color attributes (colors 0 to 7) are:
152
153 on_black on_red on_green on yellow
154 on_blue on_magenta on_cyan on_white
155
156 The recognized bright background color attributes (colors 8 to 15) are:
157
158 on_bright_black on_bright_red on_bright_green on_bright_yellow
159 on_bright_blue on_bright_magenta on_bright_cyan on_bright_white
160
161 For 256-color terminals, the recognized foreground colors are:
162
163 ansi0 .. ansi255
164 grey0 .. grey23
165
166 plus "rgbRGB" for R, G, and B values from 0 to 5, such as "rgb000" or
167 "rgb515". Similarly, the recognized background colors are:
168
169 on_ansi0 .. on_ansi255
170 on_grey0 .. on_grey23
171
172 plus "on_rgbRGB" for R, G, and B values from 0 to 5.
173
174 For any of the above listed attributes, case is not significant.
175
176 Attributes, once set, last until they are unset (by printing the
177 attribute "clear" or "reset"). Be careful to do this, or otherwise
178 your attribute will last after your script is done running, and people
179 get very annoyed at having their prompt and typing changed to weird
180 colors.
181
182 color(ATTR[, ATTR ...])
183 color() takes any number of strings as arguments and considers them
184 to be space-separated lists of attributes. It then forms and
185 returns the escape sequence to set those attributes. It doesn't
186 print it out, just returns it, so you'll have to print it yourself
187 if you want to. This is so that you can save it as a string, pass
188 it to something else, send it to a file handle, or do anything else
189 with it that you might care to. color() throws an exception if
190 given an invalid attribute.
191
192 colored(STRING, ATTR[, ATTR ...])
193 colored(ATTR-REF, STRING[, STRING...])
194 As an aid in resetting colors, colored() takes a scalar as the
195 first argument and any number of attribute strings as the second
196 argument and returns the scalar wrapped in escape codes so that the
197 attributes will be set as requested before the string and reset to
198 normal after the string. Alternately, you can pass a reference to
199 an array as the first argument, and then the contents of that array
200 will be taken as attributes and color codes and the remainder of
201 the arguments as text to colorize.
202
203 Normally, colored() just puts attribute codes at the beginning and
204 end of the string, but if you set $Term::ANSIColor::EACHLINE to
205 some string, that string will be considered the line delimiter and
206 the attribute will be set at the beginning of each line of the
207 passed string and reset at the end of each line. This is often
208 desirable if the output contains newlines and you're using
209 background colors, since a background color that persists across a
210 newline is often interpreted by the terminal as providing the
211 default background color for the next line. Programs like pagers
212 can also be confused by attributes that span lines. Normally
213 you'll want to set $Term::ANSIColor::EACHLINE to "\n" to use this
214 feature.
215
216 uncolor(ESCAPE)
217 uncolor() performs the opposite translation as color(), turning
218 escape sequences into a list of strings corresponding to the
219 attributes being set by those sequences. uncolor() will never
220 return "ansi16" through "ansi255", instead preferring the "grey"
221 and "rgb" names (and likewise for "on_ansi16" through
222 "on_ansi255").
223
224 colorstrip(STRING[, STRING ...])
225 colorstrip() removes all color escape sequences from the provided
226 strings, returning the modified strings separately in array context
227 or joined together in scalar context. Its arguments are not
228 modified.
229
230 colorvalid(ATTR[, ATTR ...])
231 colorvalid() takes attribute strings the same as color() and
232 returns true if all attributes are known and false otherwise.
233
234 coloralias(ALIAS[, ATTR])
235 If ATTR is specified, coloralias() sets up an alias of ALIAS for
236 the standard color ATTR. From that point forward, ALIAS can be
237 passed into color(), colored(), and colorvalid() and will have the
238 same meaning as ATTR. One possible use of this facility is to give
239 more meaningful names to the 256-color RGB colors. Only ASCII
240 alphanumerics, ".", "_", and "-" are allowed in alias names.
241
242 If ATTR is not specified, coloralias() returns the standard color
243 name to which ALIAS is aliased, if any, or undef if ALIAS does not
244 exist.
245
246 This is the same facility used by the ANSI_COLORS_ALIASES
247 environment variable (see "ENVIRONMENT" below) but can be used at
248 runtime, not just when the module is loaded.
249
250 Later invocations of coloralias() with the same ALIAS will override
251 earlier aliases. There is no way to remove an alias.
252
253 Aliases have no effect on the return value of uncolor().
254
255 WARNING: Aliases are global and affect all callers in the same
256 process. There is no way to set an alias limited to a particular
257 block of code or a particular object.
258
259 Constant Interface
260 Alternately, if you import ":constants", you can use the following
261 constants directly:
262
263 CLEAR RESET BOLD DARK
264 FAINT ITALIC UNDERLINE UNDERSCORE
265 BLINK REVERSE CONCEALED
266
267 BLACK RED GREEN YELLOW
268 BLUE MAGENTA CYAN WHITE
269 BRIGHT_BLACK BRIGHT_RED BRIGHT_GREEN BRIGHT_YELLOW
270 BRIGHT_BLUE BRIGHT_MAGENTA BRIGHT_CYAN BRIGHT_WHITE
271
272 ON_BLACK ON_RED ON_GREEN ON_YELLOW
273 ON_BLUE ON_MAGENTA ON_CYAN ON_WHITE
274 ON_BRIGHT_BLACK ON_BRIGHT_RED ON_BRIGHT_GREEN ON_BRIGHT_YELLOW
275 ON_BRIGHT_BLUE ON_BRIGHT_MAGENTA ON_BRIGHT_CYAN ON_BRIGHT_WHITE
276
277 These are the same as color('attribute') and can be used if you prefer
278 typing:
279
280 print BOLD BLUE ON_WHITE "Text", RESET, "\n";
281
282 to
283
284 print colored ("Text", 'bold blue on_white'), "\n";
285
286 (Note that the newline is kept separate to avoid confusing the terminal
287 as described above since a background color is being used.)
288
289 If you import ":constants256", you can use the following constants
290 directly:
291
292 ANSI0 .. ANSI255
293 GREY0 .. GREY23
294
295 RGBXYZ (for X, Y, and Z values from 0 to 5, like RGB000 or RGB515)
296
297 ON_ANSI0 .. ON_ANSI255
298 ON_GREY0 .. ON_GREY23
299
300 ON_RGBXYZ (for X, Y, and Z values from 0 to 5)
301
302 Note that ":constants256" does not include the other constants, so if
303 you want to mix both, you need to include ":constants" as well. You
304 may want to explicitly import at least "RESET", as in:
305
306 use Term::ANSIColor 4.00 qw(RESET :constants256);
307
308 When using the constants, if you don't want to have to remember to add
309 the ", RESET" at the end of each print line, you can set
310 $Term::ANSIColor::AUTORESET to a true value. Then, the display mode
311 will automatically be reset if there is no comma after the constant.
312 In other words, with that variable set:
313
314 print BOLD BLUE "Text\n";
315
316 will reset the display mode afterward, whereas:
317
318 print BOLD, BLUE, "Text\n";
319
320 will not. If you are using background colors, you will probably want
321 to either use say() (in newer versions of Perl) or print the newline
322 with a separate print statement to avoid confusing the terminal.
323
324 If $Term::ANSIColor::AUTOLOCAL is set (see below), it takes precedence
325 over $Term::ANSIColor::AUTORESET, and the latter is ignored.
326
327 The subroutine interface has the advantage over the constants interface
328 in that only two subroutines are exported into your namespace, versus
329 thirty-eight in the constants interface. On the flip side, the
330 constants interface has the advantage of better compile time error
331 checking, since misspelled names of colors or attributes in calls to
332 color() and colored() won't be caught until runtime whereas misspelled
333 names of constants will be caught at compile time. So, pollute your
334 namespace with almost two dozen subroutines that you may not even use
335 that often, or risk a silly bug by mistyping an attribute. Your
336 choice, TMTOWTDI after all.
337
338 The Color Stack
339 You can import ":pushpop" and maintain a stack of colors using
340 PUSHCOLOR, POPCOLOR, and LOCALCOLOR. PUSHCOLOR takes the attribute
341 string that starts its argument and pushes it onto a stack of
342 attributes. POPCOLOR removes the top of the stack and restores the
343 previous attributes set by the argument of a prior PUSHCOLOR.
344 LOCALCOLOR surrounds its argument in a PUSHCOLOR and POPCOLOR so that
345 the color resets afterward.
346
347 If $Term::ANSIColor::AUTOLOCAL is set, each sequence of color constants
348 will be implicitly preceded by LOCALCOLOR. In other words, the
349 following:
350
351 {
352 local $Term::ANSIColor::AUTOLOCAL = 1;
353 print BLUE "Text\n";
354 }
355
356 is equivalent to:
357
358 print LOCALCOLOR BLUE "Text\n";
359
360 If $Term::ANSIColor::AUTOLOCAL is set, it takes precedence over
361 $Term::ANSIColor::AUTORESET, and the latter is ignored.
362
363 When using PUSHCOLOR, POPCOLOR, and LOCALCOLOR, it's particularly
364 important to not put commas between the constants.
365
366 print PUSHCOLOR BLUE "Text\n";
367
368 will correctly push BLUE onto the top of the stack.
369
370 print PUSHCOLOR, BLUE, "Text\n"; # wrong!
371
372 will not, and a subsequent pop won't restore the correct attributes.
373 PUSHCOLOR pushes the attributes set by its argument, which is normally
374 a string of color constants. It can't ask the terminal what the
375 current attributes are.
376
378 Bad color mapping %s
379 (W) The specified color mapping from ANSI_COLORS_ALIASES is not
380 valid and could not be parsed. It was ignored.
381
382 Bad escape sequence %s
383 (F) You passed an invalid ANSI escape sequence to uncolor().
384
385 Bareword "%s" not allowed while "strict subs" in use
386 (F) You probably mistyped a constant color name such as:
387
388 $Foobar = FOOBAR . "This line should be blue\n";
389
390 or:
391
392 @Foobar = FOOBAR, "This line should be blue\n";
393
394 This will only show up under use strict (another good reason to run
395 under use strict).
396
397 Cannot alias standard color %s
398 (F) The alias name passed to coloralias() matches a standard color
399 name. Standard color names cannot be aliased.
400
401 Cannot alias standard color %s in %s
402 (W) The same, but in ANSI_COLORS_ALIASES. The color mapping was
403 ignored.
404
405 Invalid alias name %s
406 (F) You passed an invalid alias name to coloralias(). Alias names
407 must consist only of alphanumerics, ".", "-", and "_".
408
409 Invalid alias name %s in %s
410 (W) You specified an invalid alias name on the left hand of the
411 equal sign in a color mapping in ANSI_COLORS_ALIASES. The color
412 mapping was ignored.
413
414 Invalid attribute name %s
415 (F) You passed an invalid attribute name to color(), colored(), or
416 coloralias().
417
418 Invalid attribute name %s in %s
419 (W) You specified an invalid attribute name on the right hand of
420 the equal sign in a color mapping in ANSI_COLORS_ALIASES. The
421 color mapping was ignored.
422
423 Name "%s" used only once: possible typo
424 (W) You probably mistyped a constant color name such as:
425
426 print FOOBAR "This text is color FOOBAR\n";
427
428 It's probably better to always use commas after constant names in
429 order to force the next error.
430
431 No comma allowed after filehandle
432 (F) You probably mistyped a constant color name such as:
433
434 print FOOBAR, "This text is color FOOBAR\n";
435
436 Generating this fatal compile error is one of the main advantages
437 of using the constants interface, since you'll immediately know if
438 you mistype a color name.
439
440 No name for escape sequence %s
441 (F) The ANSI escape sequence passed to uncolor() contains escapes
442 which aren't recognized and can't be translated to names.
443
445 ANSI_COLORS_ALIASES
446 This environment variable allows the user to specify custom color
447 aliases that will be understood by color(), colored(), and
448 colorvalid(). None of the other functions will be affected, and no
449 new color constants will be created. The custom colors are aliases
450 for existing color names; no new escape sequences can be
451 introduced. Only alphanumerics, ".", "_", and "-" are allowed in
452 alias names.
453
454 The format is:
455
456 ANSI_COLORS_ALIASES='newcolor1=oldcolor1,newcolor2=oldcolor2'
457
458 Whitespace is ignored.
459
460 For example the Solarized <http://ethanschoonover.com/solarized>
461 colors can be mapped with:
462
463 ANSI_COLORS_ALIASES='\
464 base00=bright_yellow, on_base00=on_bright_yellow,\
465 base01=bright_green, on_base01=on_bright_green, \
466 base02=black, on_base02=on_black, \
467 base03=bright_black, on_base03=on_bright_black, \
468 base0=bright_blue, on_base0=on_bright_blue, \
469 base1=bright_cyan, on_base1=on_bright_cyan, \
470 base2=white, on_base2=on_white, \
471 base3=bright_white, on_base3=on_bright_white, \
472 orange=bright_red, on_orange=on_bright_red, \
473 violet=bright_magenta,on_violet=on_bright_magenta'
474
475 This environment variable is read and applied when the
476 Term::ANSIColor module is loaded and is then subsequently ignored.
477 Changes to ANSI_COLORS_ALIASES after the module is loaded will have
478 no effect. See coloralias() for an equivalent facility that can be
479 used at runtime.
480
481 ANSI_COLORS_DISABLED
482 If this environment variable is set to a true value, all of the
483 functions defined by this module (color(), colored(), and all of
484 the constants not previously used in the program) will not output
485 any escape sequences and instead will just return the empty string
486 or pass through the original text as appropriate. This is intended
487 to support easy use of scripts using this module on platforms that
488 don't support ANSI escape sequences.
489
491 Term::ANSIColor was first included with Perl in Perl 5.6.0.
492
493 The uncolor() function and support for ANSI_COLORS_DISABLED were added
494 in Term::ANSIColor 1.04, included in Perl 5.8.0.
495
496 Support for dark was added in Term::ANSIColor 1.08, included in Perl
497 5.8.4.
498
499 The color stack, including the ":pushpop" import tag, PUSHCOLOR,
500 POPCOLOR, LOCALCOLOR, and the $Term::ANSIColor::AUTOLOCAL variable, was
501 added in Term::ANSIColor 2.00, included in Perl 5.10.1.
502
503 colorstrip() was added in Term::ANSIColor 2.01 and colorvalid() was
504 added in Term::ANSIColor 2.02, both included in Perl 5.11.0.
505
506 Support for colors 8 through 15 (the "bright_" variants) was added in
507 Term::ANSIColor 3.00, included in Perl 5.13.3.
508
509 Support for italic was added in Term::ANSIColor 3.02, included in Perl
510 5.17.1.
511
512 Support for colors 16 through 256 (the "ansi", "rgb", and "grey"
513 colors), the ":constants256" import tag, the coloralias() function, and
514 support for the ANSI_COLORS_ALIASES environment variable were added in
515 Term::ANSIColor 4.00, included in Perl 5.17.8.
516
517 $Term::ANSIColor::AUTOLOCAL was changed to take precedence over
518 $Term::ANSIColor::AUTORESET, rather than the other way around, in
519 Term::ANSIColor 4.00, included in Perl 5.17.8.
520
521 "ansi16" through "ansi255", as aliases for the "rgb" and "grey" colors,
522 and the corresponding "on_ansi" names and "ANSI" and "ON_ANSI"
523 constants, were added in Term::ANSIColor 4.06.
524
526 It would be nice if one could leave off the commas around the constants
527 entirely and just say:
528
529 print BOLD BLUE ON_WHITE "Text\n" RESET;
530
531 but the syntax of Perl doesn't allow this. You need a comma after the
532 string. (Of course, you may consider it a bug that commas between all
533 the constants aren't required, in which case you may feel free to
534 insert commas unless you're using $Term::ANSIColor::AUTORESET or
535 PUSHCOLOR/POPCOLOR.)
536
537 For easier debugging, you may prefer to always use the commas when not
538 setting $Term::ANSIColor::AUTORESET or PUSHCOLOR/POPCOLOR so that
539 you'll get a fatal compile error rather than a warning.
540
541 It's not possible to use this module to embed formatting and color
542 attributes using Perl formats. They replace the escape character with
543 a space (as documented in perlform(1)), resulting in garbled output
544 from the unrecognized attribute. Even if there were a way around that
545 problem, the format doesn't know that the non-printing escape sequence
546 is zero-length and would incorrectly format the output. For formatted
547 output using color or other attributes, either use sprintf() instead or
548 use formline() and then add the color or other attributes after
549 formatting and before output.
550
552 The codes generated by this module are standard terminal control codes,
553 complying with ECMA-048 and ISO 6429 (generally referred to as "ANSI
554 color" for the color codes). The non-color control codes (bold, dark,
555 italic, underline, and reverse) are part of the earlier ANSI X3.64
556 standard for control sequences for video terminals and peripherals.
557
558 Note that not all displays are ISO 6429-compliant, or even
559 X3.64-compliant (or are even attempting to be so). This module will
560 not work as expected on displays that do not honor these escape
561 sequences, such as cmd.exe, 4nt.exe, and command.com under either
562 Windows NT or Windows 2000. They may just be ignored, or they may
563 display as an ESC character followed by some apparent garbage.
564
565 Jean Delvare provided the following table of different common terminal
566 emulators and their support for the various attributes and others have
567 helped me flesh it out:
568
569 clear bold faint under blink reverse conceal
570 ------------------------------------------------------------------------
571 xterm yes yes no yes yes yes yes
572 linux yes yes yes bold yes yes no
573 rxvt yes yes no yes bold/black yes no
574 dtterm yes yes yes yes reverse yes yes
575 teraterm yes reverse no yes rev/red yes no
576 aixterm kinda normal no yes no yes yes
577 PuTTY yes color no yes no yes no
578 Windows yes no no no no yes no
579 Cygwin SSH yes yes no color color color yes
580 Terminal.app yes yes no yes yes yes yes
581
582 Windows is Windows telnet, Cygwin SSH is the OpenSSH implementation
583 under Cygwin on Windows NT, and Mac Terminal is the Terminal
584 application in Mac OS X. Where the entry is other than yes or no, that
585 emulator displays the given attribute as something else instead. Note
586 that on an aixterm, clear doesn't reset colors; you have to explicitly
587 set the colors back to what you want. More entries in this table are
588 welcome.
589
590 Support for code 3 (italic) is rare and therefore not mentioned in that
591 table. It is not believed to be fully supported by any of the
592 terminals listed, although it's displayed as green in the Linux
593 console, but it is reportedly supported by urxvt.
594
595 Note that codes 6 (rapid blink) and 9 (strike-through) are specified in
596 ANSI X3.64 and ECMA-048 but are not commonly supported by most displays
597 and emulators and therefore aren't supported by this module at the
598 present time. ECMA-048 also specifies a large number of other
599 attributes, including a sequence of attributes for font changes,
600 Fraktur characters, double-underlining, framing, circling, and
601 overlining. As none of these attributes are widely supported or
602 useful, they also aren't currently supported by this module.
603
604 Most modern X terminal emulators support 256 colors. Known to not
605 support those colors are aterm, rxvt, Terminal.app, and TTY/VC.
606
608 Original idea (using constants) by Zenin, reimplemented using subs by
609 Russ Allbery <rra@cpan.org>, and then combined with the original idea
610 by Russ with input from Zenin. 256-color support is based on work by
611 Kurt Starsinic. Russ Allbery now maintains this module.
612
613 PUSHCOLOR, POPCOLOR, and LOCALCOLOR were contributed by openmethods.com
614 voice solutions.
615
617 Copyright 1996 Zenin
618
619 Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2005, 2006, 2008, 2009,
620 2010, 2011, 2012, 2013, 2014, 2015, 2016 Russ Allbery <rra@cpan.org>
621
622 Copyright 2012 Kurt Starsinic <kstarsinic@gmail.com>
623
624 This program is free software; you may redistribute it and/or modify it
625 under the same terms as Perl itself.
626
628 The CPAN module Term::ExtendedColor provides a different and more
629 comprehensive interface for 256-color emulators that may be more
630 convenient. The CPAN module Win32::Console::ANSI provides ANSI color
631 (and other escape sequence) support in the Win32 Console environment.
632 The CPAN module Term::Chrome provides a different interface using
633 objects and operator overloading.
634
635 ECMA-048 is available on-line (at least at the time of this writing) at
636 <http://www.ecma-international.org/publications/standards/Ecma-048.htm>.
637
638 ISO 6429 is available from ISO for a charge; the author of this module
639 does not own a copy of it. Since the source material for ISO 6429 was
640 ECMA-048 and the latter is available for free, there seems little
641 reason to obtain the ISO standard.
642
643 The 256-color control sequences are documented at
644 <http://invisible-island.net/xterm/ctlseqs/ctlseqs.html> (search for
645 256-color).
646
647 The current version of this module is always available from its web
648 site at <https://www.eyrie.org/~eagle/software/ansicolor/>. It is also
649 part of the Perl core distribution as of 5.6.0.
650
651
652
653perl v5.28.0 2016-10-28 Term::ANSIColor(3)