[UP]


Manual Reference Pages  - attr (3)

NAME

attr(3f) - [M_escape] colorize text using a simple function-based approach (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Returns
Example
Author
License

SYNOPSIS

function attr(attribute) result (out)

   character(len=*),intent(in)  :: attribute
   character(len=:),allocatable :: out

DESCRIPTION

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.

OPTIONS

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

RETURNS

out output the strings assigned by the keywords (by default ANSI video display escape sequences, see update(3f) )

EXAMPLE

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

AUTHOR

John S. Urban, 2020

LICENSE

Public Domain


attr (3) March 11, 2021
Generated by manServer 1.08 from 2df9b6f6-4821-4425-868a-a92f02f141e2 using man macros.