attr(3f) - [M_escape] colorize text using a simple function-based approach (LICENSE:PD)
Synopsis
Description
Options
Returns
Example
Author
License
function attr(attribute) result (out)
character(len=*),intent(in) :: attribute character(len=:),allocatable :: out
attr(3f) uses the same keywords as esc(3f) to send ANSI escape sequences to the display screen, except instead of using a pseudo-XML string to select the codes it uses a simple colon-delimited list of the keywords.
attribute colon, space, or comma-delimited list of attribute keywords as defined in the esc(3f) procedure. text if supplied it is printed and then an attribute reset is added
out output the strings assigned by the keywords (by default ANSI video display escape sequences, see update(3f) )
Sample program
program demo_attr use M_escape, only : attr, esc_mode implicit none call printme(color) call printme(plain) call printme(raw) contains subroutine printme(mymode) character(len=*),intent(in) :: mymode call esc_mode(mymode) write(*,(a))mymode write(*,(*(g0)),advance=no)attr(red:BLUE:bold,Hello!), & & and everything is back to defaults or , & & attr(RED:blue:bold),Hello Again!, & & attr(/RED), Well, the text color is still blue.,attr(reset) write(*,(*(g0)),advance=yes) Back to a normal write statement. end subroutine printme end program demo_attr
John S. Urban, 2020
Public Domain
attr (3) | March 11, 2021 |