BBS-Universal

 view release on metacpan or  search on metacpan

lib/BBS/Universal/ANSI.pm  view on Meta::CPAN

	};
###
	# Special sequences
	my $special = $pairs_to_map->(
		['APC', "\e_",   'Application Program Command'],
		['SS2', "\eN",   'Single Shift 2'],
		['SS3', "\eO",   'Single Shift 3'],
		['CSI', "\e[",   'Control Sequence Introducer'],
		['OSC', "\e]",   'Operating System Command'],
		['SOS', "\eX",   'Start Of String'],
		['ST',  "\e\\",  'String Terminator'],
		['DCS', "\eP",   'Device Control String'],
	);

	# Clear controls
	my $clear = $pairs_to_map->(
		['CLS',        "\e[2J\e[H",           'Clear screen and place cursor at the top of the screen'],
		['CLEAR',      "\e[2J",               'Clear screen and keep cursor location'],
		['CLEAR LINE', "\e[0K",               'Clear the current line from cursor'],
		['CLEAR DOWN', "\e[0J",               'Clear from cursor position to bottom of the screen'],
		['CLEAR UP',   "\e[1J",               'Clear to the top of the screen from cursor position'],
	);

	# Cursor movement and control
	my $cursor = $pairs_to_map->(
		['BACKSPACE',     chr(8),            'Backspace'],
		['RETURN',        chr(13),           'Carriage Return (ASCII 13)'],
		['LINEFEED',      chr(10),           'Line feed (ASCII 10)'],
		['NEWLINE',       chr(13) . chr(10), 'New line (ASCII 13 and ASCII 10)'],
		['HOME',          "\e[H",            'Place cursor at top left of the screen'],
		['UP',            "\e[A",            'Move cursor up one line'],
		['DOWN',          "\e[B",            'Move cursor down one line'],
		['RIGHT',         "\e[C",            'Move cursor right one space non-destructively'],
		['LEFT',          "\e[D",            'Move cursor left one space non-destructively'],
		['NEXT LINE',     "\e[E",            'Place the cursor at the beginning of the next line'],
		['PREVIOUS LINE', "\e[F",            'Place the cursor at the beginning of the previous line'],
		['SAVE',          "\e[s",            'Save cureent cursor position'],
		['RESTORE',       "\e[u",            'Restore the cursor to the saved position'],
		['CURSOR ON',     "\e[?25h",         'Turn the cursor on'],
		['CURSOR OFF',    "\e[?25l",         'Turn the cursor off'],
		['SCREEN 1',      "\e[?1049l",       'Set display to screen 1'],
		['SCREEN 2',      "\e[?1049h",       'Set display to screen 2'],
	);

	# Text attributes
	my $attributes = $pairs_to_map->(
		['FONT 1',                    "\e[1m",  'ANSI FONT 1'],
		['FONT 2',                    "\e[2m",  'ANSI FONT 2'],
		['FONT 3',                    "\e[3m",  'ANSI FONT 3'],
		['FONT 4',                    "\e[4m",  'ANSI FONT 4'],
		['FONT 5',                    "\e[5m",  'ANSI FONT 5'],
		['FONT 6',                    "\e[6m",  'ANSI FONT 6'],
		['FONT 7',                    "\e[7m",  'ANSI FONT 7'],
		['FONT 8',                    "\e[8m",  'ANSI FONT 8'],
		['FONT 9',                    "\e[9m",  'ANSI FONT 9'],
		['FONT DOUBLE-HEIGHT TOP',    "\e#3",   'Double-Height Font Top Portion'],
		['FONT DOUBLE-HEIGHT BOTTOM', "\e#4",   'Double-Height Font Bottom Portion'],
		['FONT DOUBLE-WIDTH',         "\e#6",   'Double-Width Font'],
		['FONT DEFAULT SIZE',         "\e#5",   'Default Font Size'],
		['RESET',                     "\e[0m",  'Restore all attributes and colors to their defaults'],
		['BOLD',                      "\e[1m",  'Set to bold text'],
		['NORMAL',                    "\e[22m", 'Turn off all attributes'],
		['FAINT',                     "\e[2m",  'Set to faint (light) text'],
		['ITALIC',                    "\e[3m",  'Set to italic text'],
		['UNDERLINE',                 "\e[4m",  'Set to underlined text'],
		['DEFAULT UNDERLINE COLOR',   "\e[59m", 'Set underline color to the default'],
		['FRAMED',                    "\e[51m", 'Turn on framed text'],
		['FRAMED OFF',                "\e[54m", 'Turn off framed text'],
		['ENCIRCLED',                 "\e[52m", 'Turn on encircled letters'],
		['ENCIRCLED OFF',             "\e[54m", 'Turn off encircled letters'],
		['OVERLINED',                 "\e[53m", 'Turn on overlined text'],
		['OVERLINED OFF',             "\e[55m", 'Turn off overlined text'],
		['SUPERSCRIPT',               "\e[73m", 'Turn on superscript'],
		['SUBSCRIPT',                 "\e[74m", 'Turn on superscript'],
		['SUPERSCRIPT OFF',           "\e[75m", 'Turn off superscript'],
		['SUBSCRIPT OFF',             "\e[75m", 'Turn off subscript'],
		['SLOW BLINK',                "\e[5m",  'Set slow blink'],
		['RAPID BLINK',               "\e[6m",  'Set rapid blink'],
		['INVERT',                    "\e[7m",  'Invert text'],
		['REVERSE',                   "\e[7m",  'Invert text'],
		['HIDE',                      "\e[8m",  'Hide enclosed text'],
		['REVEAL',                    "\e[28m", 'Reveal hidden text'],
		['CROSSED OUT',               "\e[9m",  'Crossed out text'],
		['FONT DEFAULT',              "\e[10m", 'Set default font'],
		['PROPORTIONAL ON',           "\e[26m", 'Turn on proportional text'],
		['PROPORTIONAL OFF',          "\e[50m", 'Turn off proportional text'],
		['RING BELL',                 chr(7),   'Console bell'],
	);

	# Foreground (base 16 + bright variants)
	my @fg16 = (
		['DEFAULT',        "\e[39m", 'Default foreground color'],
		['BLACK',          "\e[30m", 'Black'],
		['RED',            "\e[31m", 'Red'],
		['GREEN',          "\e[32m", 'Green'],
		['YELLOW',         "\e[33m", 'Yellow'],
		['BLUE',           "\e[34m", 'Blue'],
		['MAGENTA',        "\e[35m", 'Magenta'],
		['CYAN',           "\e[36m", 'Cyan'],
		['WHITE',          "\e[37m", 'White'],
		['BRIGHT BLACK',   "\e[90m", 'Bright black'],
		['BRIGHT RED',     "\e[91m", 'Bright red'],
		['BRIGHT GREEN',   "\e[92m", 'Bright green'],
		['BRIGHT YELLOW',  "\e[93m", 'Bright yellow'],
		['BRIGHT BLUE',    "\e[94m", 'Bright blue'],
		['BRIGHT MAGENTA', "\e[95m", 'Bright magenta'],
		['BRIGHT CYAN',    "\e[96m", 'Bright cyan'],
		['BRIGHT WHITE',   "\e[97m", 'Bright white'],
	);

	# Foreground extensions: all named 256-color and truecolor entries

    # Foreground extensions: all named 256-color and truecolor entries
	my @fg_extra = (
		['NAVY',                          "\e[38;5;17m",           'Navy'],
		['PINK',                          "\e[38;5;198m",          'Pink'],
		['AIR FORCE BLUE',                "\e[38;2;93;138;168m",   'Air Force blue'],
		['ALICE BLUE',                    "\e[38;2;240;248;255m",  'Alice blue'],
		['ALIZARIN CRIMSON',              "\e[38;2;227;38;54m",    'Alizarin crimson'],
		['ALMOND',                        "\e[38;2;239;222;205m",  'Almond'],
		['AMARANTH',                      "\e[38;2;229;43;80m",    'Amaranth'],



( run in 0.604 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )