stdlib_ansi#

See also the specification page: stdlib_ansi.

stdlib_ansi (module)#

Terminal color and style escape sequences

Variables

style_resettype(ansi_code), parameter, Default = ansi_code(style=0)

Identifier for reset style

style_boldtype(ansi_code), parameter, Default = ansi_code(style=1)

Identifier for bold style

style_dimtype(ansi_code), parameter, Default = ansi_code(style=2)

Identifier for dim style

style_italictype(ansi_code), parameter, Default = ansi_code(style=3)

Identifier for italic style

style_underlinetype(ansi_code), parameter, Default = ansi_code(style=4)

Identifier for underline style

style_blinktype(ansi_code), parameter, Default = ansi_code(style=5)

Identifier for blink style

style_blink_fasttype(ansi_code), parameter, Default = ansi_code(style=6)

Identifier for (fast) blink style

style_reversetype(ansi_code), parameter, Default = ansi_code(style=7)

Identifier for reverse style

style_hiddentype(ansi_code), parameter, Default = ansi_code(style=8)

Identifier for hidden style

style_strikethroughtype(ansi_code), parameter, Default = ansi_code(style=9)

Identifier for strikethrough style

fg_color_blacktype(ansi_code), parameter, Default = ansi_code(fg=0)

Identifier for black foreground color

fg_color_redtype(ansi_code), parameter, Default = ansi_code(fg=1)

Identifier for red foreground color

fg_color_greentype(ansi_code), parameter, Default = ansi_code(fg=2)

Identifier for green foreground color

fg_color_yellowtype(ansi_code), parameter, Default = ansi_code(fg=3)

Identifier for yellow foreground color

fg_color_bluetype(ansi_code), parameter, Default = ansi_code(fg=4)

Identifier for blue foreground color

fg_color_magentatype(ansi_code), parameter, Default = ansi_code(fg=5)

Identifier for magenta foreground color

fg_color_cyantype(ansi_code), parameter, Default = ansi_code(fg=6)

Identifier for cyan foreground color

fg_color_whitetype(ansi_code), parameter, Default = ansi_code(fg=7)

Identifier for white foreground color

fg_color_defaulttype(ansi_code), parameter, Default = ansi_code(fg=9)

Identifier for the default foreground color

bg_color_blacktype(ansi_code), parameter, Default = ansi_code(bg=0)

Identifier for black background color

bg_color_redtype(ansi_code), parameter, Default = ansi_code(bg=1)

Identifier for red background color

bg_color_greentype(ansi_code), parameter, Default = ansi_code(bg=2)

Identifier for green background color

bg_color_yellowtype(ansi_code), parameter, Default = ansi_code(bg=3)

Identifier for yellow background color

bg_color_bluetype(ansi_code), parameter, Default = ansi_code(bg=4)

Identifier for blue background color

bg_color_magentatype(ansi_code), parameter, Default = ansi_code(bg=5)

Identifier for magenta background color

bg_color_cyantype(ansi_code), parameter, Default = ansi_code(bg=6)

Identifier for cyan background color

bg_color_whitetype(ansi_code), parameter, Default = ansi_code(bg=7)

Identifier for white background color

bg_color_defaulttype(ansi_code), parameter, Default = ansi_code(bg=9)

Identifier for the default background color

Types

ansi_code (type)#

ansi_code (type)

Container for terminal escape code

Interfaces

to_string (interface)#

to_string (interface)
Procedures:
pure module function to_string_ansi_code(code) -> str#

Transform a color code into an actual ANSI escape sequence

Arguments:
codetype(ansi_code), intent(in)

Color code to be used

Returns:
strcharacter(len=:), allocatable

ANSI escape sequence representing the color code

operator(+) (interface)#

operator(+) (interface)
Procedures:
pure module function add(lval, rval) -> code#

Add two escape sequences, attributes in the right value override the left value ones.

Arguments:
lvaltype(ansi_code), intent(in)

First escape code

rvaltype(ansi_code), intent(in)

Second escape code

Returns:
codetype(ansi_code)

Combined escape code

operator(//) (interface)#

operator(//) (interface)
Procedures:
pure module function concat_left(lval, code) -> str#

Concatenate an escape code with a string and turn it into an actual escape sequence

Arguments:
lvalcharacter(len=*), intent(in)

String to add the escape code to

codetype(ansi_code), intent(in)

Escape sequence

Returns:
strcharacter(len=:), allocatable

Concatenated string

pure module function concat_right(code, rval) -> str#

Concatenate an escape code with a string and turn it into an actual escape sequence

Arguments:
codetype(ansi_code), intent(in)

Escape sequence

rvalcharacter(len=*), intent(in)

String to add the escape code to

Returns:
strcharacter(len=:), allocatable

Concatenated string

pure module function concat_left_str(lval, code) -> str#

Concatenate an escape code with a string and turn it into an actual escape sequence

Arguments:
lvaltype(string_type), intent(in)

String to add the escape code to

codetype(ansi_code), intent(in)

Escape sequence

Returns:
strtype(string_type)

Concatenated string

pure module function concat_right_str(code, rval) -> str#

Concatenate an escape code with a string and turn it into an actual escape sequence

Arguments:
codetype(ansi_code), intent(in)

Escape sequence

rvaltype(string_type), intent(in)

String to add the escape code to

Returns:
strtype(string_type)

Concatenated string