mod_painting Module

This module handles formatting of terminal-printed strings. Contains subroutines to colourise strings.


Contents


Variables

TypeVisibilityAttributesNameInitial
character(len=*), public, parameter:: esc =achar(27)

escape character for logging

character(len=*), public, parameter:: term =esc//"[0m"

termination character for logging

character(len=*), public, parameter:: red =esc//"[31m"

red ANSI colour sequence

character(len=*), public, parameter:: green =esc//"[32m"

green ANSI colour sequence

character(len=*), public, parameter:: yellow =esc//"[33m"

yellow ANSI colour sequence

character(len=*), public, parameter:: blue =esc//"[34m"

blue ANSI colour sequence

character(len=*), public, parameter:: cyan =esc//"[36m"

cyan ANSI colour sequence

character(len=*), public, parameter:: grey =esc//"[90m"

grey ANSI colour sequence


Functions

public pure function paint_string(msg, colour) result(msg_painted)

Subroutine to paint a given string to the desired colour, returns a new string with ANSI escape sequences prepended and appended. If the 'colour' argument is not known, simply returns the string itself.

Arguments

TypeIntentOptionalAttributesName
character(len=*), intent(in) :: msg

message to print to the console

character(len=*), intent(in) :: colour

colour of the message

Return Value character,allocatable

new string with ANSI sequences added