NAME
Term::ANSIEncode
SYNOPSIS
A markup language to generate basic ANSI text. A terminal that supports UTF-8 is required if you wish to have special characters, both graphical and international.
USAGE
my $ansi = Term::ANSIEncode->new;
my $string = '[% CLS %]Some markup encoded string';
$ansi->ansi_output($string);
TOKENS
GENERAL
- [% RETURN %]
-
ASCII RETURN (13)
- [% LINEFEED %]
-
ASCII LINEFEED (10)
- [% NEWLINE %]
-
RETURN + LINEFEED (13 + 10)
- [% CLS %]
-
Places cursor at top left, screen cleared
- [% CLEAR %]
-
Clear screen only, cursor remains where it was
- [% CLEAR LINE %]
-
Clear to the end of line
- [% CLEAR DOWN %]
-
Clear down from current cursor position
- [% CLEAR UP %]
-
Clear up from current cursor position
- [% RESET %]
-
Reset all colors and attributes
CURSOR
- [% HOME %]
-
Moves the cursor to the location 1,1.
- [% UP %]
-
Moves cursor up one step
- [% DOWN %]
-
Moves cursor down one step
- [% RIGHT %]
-
Moves cursor right one step
- [% LEFT %]
-
Moves cursor left one step
- [% SAVE %]
-
Save cursor position
- [% RESTORE %]
-
Place cursor at saved position
- [% BOLD %]
-
Bold text (not all terminals support this)
- [% FAINT %]
-
Faded text (not all terminals support this)
- [% ITALIC %]
-
Italicized text (not all terminals support this)
- [% UNDERLINE %]
-
Underlined text
- [% SLOW BLINK %]
-
Slow cursor blink
- [% RAPID BLINK %]
-
Rapid cursor blink
- [% LOCATE column,row %]
-
Set cursor position
ATTRIBUTES
- [% INVERT %]
-
Invert text (flip background and foreground attributes)
- [% REVERSE %]
-
Reverse
- [% CROSSED OUT %]
-
Crossed out
- {% DEFAULT FONT %]
-
Default font
FRAMES
- [% BOX color,x,y,width,height,type %] text here [% ENDBOX %]
-
Draw a frame around text
Types = THIN, ROUND, THICK, BLOCK, WEDGE, DOTS, DIAMOND, STAR, SQUARE
COLORS
FOREGROUND
There are many more foreground colors available than the ones below. However, the ones below should work on any color terminal. Other colors may requite 256 and 16 million color support. Most Linux X-Windows and Wayland terminal software should support the extra colors. Some Windows terminal software should have "Term256" features. You can used the "-t" option for all of the color tokens available or use the "RGB" token for access to 16 million colors.
- BLACK = Black =item RED = Red =item PINK = Hot pink =item ORANGE = Orange =item NAVY = Deep blue =item GREEN = Green =item YELLOW = Yellow =item BLUE = Blue =item MAGENTA = Magenta =item CYAN = Cyan =item WHITE = White =item DEFAULT = Default foreground color =item BRIGHT BLACK = Bright black (dim grey) =item BRIGHT RED = Bright red =item BRIGHT GREEN = Lime =item BRIGHT YELLOW = Bright Yellow =item BRIGHT BLUE = Bright blue =item BRIGHT MAGENTA = Bright magenta =item BRIGHT CYAN = Bright cyan =item BRIGHT WHITE = Bright white
BACKGROUND
There are many more background colors available than the ones below. However, the ones below should work on any color terminal. Other colors may requite 256 and 16 million color support. Most Linux X-Windows and Wayland terminal software should support the extra colors. Some Windows terminal software should have "Term256" features. You can used the "-t" option for all of the color tokens available or use the "B_RGB" token for access to 16 million colors.
- B_BLACK = Black =item B_RED = Red =item B_GREEN = Green =item B_YELLOW = Yellow =item B_BLUE = Blue =item B_MAGENTA = Magenta =item B_CYAN = Cyan =item B_WHITE = White =item B_DEFAULT = Default background color =item B_PINK = Hot pink =item B_ORANGE = Orange =item B_NAVY = Deep blue =item BRIGHT B_BLACK = Bright black (grey) =item BRIGHT B_RED = Bright red =item BRIGHT B_GREEN = Lime =item BRIGHT B_YELLOW = Bright yellow =item BRIGHT B_BLUE = Bright blue =item BRIGHT B_MAGENTA = Bright magenta =item BRIGHT B_CYAN = Bright cyan =item BRIGHT B_WHITE = Bright white
HORIZONAL RULES
Makes a solid blank line, the full width of the screen with the selected color
For example, for a color of blue, use the following
[% HORIZONTAL RULE BLUE %]
AUTHOR & COPYRIGHT
Richard Kelsch
Copyright (C) 2025 Richard Kelsch
All Rights Reserved
Perl Artistic License
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:
http://www.perlfoundation.org/artistic_license_2_0
8 POD Errors
The following errors were encountered while parsing the POD:
- Around line 1760:
You forgot a '=back' before '=head2'
- Around line 1762:
'=item' outside of any '=over'
- Around line 1818:
You forgot a '=back' before '=head2'
- Around line 1820:
'=item' outside of any '=over'
- Around line 1836:
You forgot a '=back' before '=head2'
- Around line 1838:
'=item' outside of any '=over'
- Around line 1844:
You forgot a '=back' before '=head2'
- Around line 1846:
'=item' outside of any '=over'