This module handles formatting of terminal-printed strings. Contains subroutines to colourise strings.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
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 |
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.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | msg |
message to print to the console |
||
character(len=*), | intent(in) | :: | colour |
colour of the message |
new string with ANSI sequences added