dm_ansi Module

ANSI escape sequences for coloured terminal output.

Add ANSI parameters directly to print statements, for instance:

print '(2a)', ANSI_CLEAR_SCREEN, 'Hello, World!'

The foreground colour may be changed through routine dm_ansi_color().

You may want to disable ANSI colour output depending on whether environment variable NO_COLOR is set, for example:

logical :: no_color
no_color = dm_env_has('NO_COLOR')
call dm_ansi_color(COLOR_RED, no_color)

Uses

  • module~~dm_ansi~~UsesGraph module~dm_ansi dm_ansi module~dm_ascii dm_ascii module~dm_ansi->module~dm_ascii

Used by

  • module~~dm_ansi~~UsedByGraph module~dm_ansi dm_ansi module~dm_logger dm_logger module~dm_logger->module~dm_ansi module~dm_test dm_test module~dm_test->module~dm_ansi module~dmpack dmpack module~dmpack->module~dm_ansi module~dmpack->module~dm_logger module~dmpack->module~dm_test

Variables

Type Visibility Attributes Name Initial
character(len=*), public, parameter :: ANSI_CLEAR_SCREEN = ASCII_ESC//'[2J'
character(len=*), public, parameter :: ANSI_RESET_CURSOR = ASCII_ESC//'[0;0H'
character(len=*), public, parameter :: ANSI_HIDE_CURSOR = ASCII_ESC//'[?25l'
character(len=*), public, parameter :: ANSI_SHOW_CURSOR = ASCII_ESC//'[?25h'
integer, public, parameter :: COLOR_BLACK = 0
integer, public, parameter :: COLOR_RED = 1
integer, public, parameter :: COLOR_GREEN = 2
integer, public, parameter :: COLOR_YELLOW = 3
integer, public, parameter :: COLOR_BLUE = 4
integer, public, parameter :: COLOR_MAGENTA = 5
integer, public, parameter :: COLOR_CYAN = 6
integer, public, parameter :: COLOR_WHITE = 7
integer, public, parameter :: COLOR_RESET = 9

Subroutines

public subroutine dm_ansi_color(color, no_color)

Changes foreground to given colour.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: color

Colour.

logical, intent(in), optional :: no_color

No output if .true..

public subroutine dm_ansi_reset(no_color)

Resets colours.

Arguments

Type IntentOptional Attributes Name
logical, intent(in), optional :: no_color