Author image brian d foy

NAME

Antsy - Streaming ANSI escape sequences

SYNOPSIS

        use Antsy qw(:all);

        print bold, underline, text_red, "Hello", reset;

DESCRIPTION

Subroutines to deal with ANSI terminal sequences. You can emit these without knowing what's coming up.

Yet another module?

There are several modules that come close to this, but so far everything is incomplete or requires you to know all of the upcoming text ahead of time so you can use of it as an argument to a function. I want to emit the sequence in a stream without knowing what's coming up.

Methods

  • bg_256( N )

  • bg_rgb

  • bg_black

  • bg_blue

  • bg_cyan

  • bg_green

  • bg_magenta

  • bg_red

  • bg_white

  • bg_yellow

    Make the background the named color

  • bg_bright_black

  • bg_bright_blue

  • bg_bright_cyan

  • bg_bright_green

  • bg_bright_magenta

  • bg_bright_red

  • bg_bright_white

  • bg_bright_yellow

    Make the background the named color and bright (however your terminal does that).

  • blink

    Make the text blink (however your terminal does that).

  • bold

    Turn on bold

  • clear_line

  • clear_screen

  • clear_to_line_end

  • clear_to_line_start

  • clear_to_screen_end

  • clear_to_screen_start

    Clear the part of the screen as indicated. Each of these start at the current cursor position.

  • conceal

    Make the text invisible (if your terminal handles that).

  • cursor_back( N )

    Move the cursor back N positions.

  • cursor_column( N )

    Move the cursor to column N.

  • cursor_down( N )

    Move the cursor down N positions.

  • cursor_forward( N )

    Move the cursor forward N positions.

  • cursor_next_line( N )

    Move the cursor down N lines, to the start of the line

  • cursor_previous_line( N )

    Move the cursor up N lines, to the start of the line

  • cursor_row_column( N, M )

    Move the cursor to row N and column M.

  • cursor_up

    TK: Fill in details

  • dark

    Make the text dark (however your terminal does that).

  • erase_in_display( [ 0, 1, 2, 3 ] )

    TK: Fill in details

  • erase_in_line( [ 0, 1, 2, 3 ] )

    TK: Fill in details

  • hide_cursor

    Hide the cursor. See also show_cursor.

  • italic

    Turn on italic.

  • reset

    Turn off all attributes

  • restore_cursor

    Put the cursor back to where you saved it. See also save_cursor.

  • reverse

    Use the background color for the text color, and the text color for the background.

  • save_cursor

    Save the current location of the cursor. See also save_cursor.

  • scroll_down( N )

    Scroll down N lines.

  • scroll_up( N )

    Scroll up N lines.

  • show_cursor

    Show the cursor. See also hide_cursor.

  • text_256( N )

    Make the foreground the color N in the xterm 256 color chart.

    This dies if N is not a positive number between 0 and 255 (inclusive).

  • text_black

  • text_blue

  • text_cyan

  • text_green

  • text_magenta

  • text_red

  • text_rgb

  • text_white

  • text_yellow

    Make foreground text the named color.

  • text_blink

    Make the text blink.

  • text_bright_black

  • text_bright_blue

  • text_bright_cyan

  • text_bright_green

  • text_bright_magenta

  • text_bright_red

  • text_bright_white

  • text_bright_yellow

    Make foreground text the named color and bright (however your terminal does that).

  • text_concealed

    Conceal the text.

  • underline

    Turn on underlining.

SEE ALSO

  • Everything you never wanted to know about ANSI escape codes https://notes.burke.libbey.me/ansi-escape-codes/

  • https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797

SOURCE AVAILABILITY

This source is in Github:

        http://github.com/briandfoy/antsy

AUTHOR

brian d foy, <bdfoy@cpan.org>

COPYRIGHT AND LICENSE

Copyright © 2021, brian d foy, All Rights Reserved.

You may redistribute this under the terms of the Artistic License 2.0.