colorize_str Function

private pure function colorize_str(self, color_fg, color_bg, style) result(colorized)

Arguments

TypeIntentOptionalAttributesName
class(string), intent(in) :: self
character(len=*), intent(in), optional :: color_fg
character(len=*), intent(in), optional :: color_bg
character(len=*), intent(in), optional :: style

Return Value character(len=:),allocatable


Calls

proc~~colorize_str~2~~CallsGraph proc~colorize_str~2 colorize_str interface~colorize colorize proc~colorize_str~2->interface~colorize proc~colorize_default colorize_default interface~colorize->proc~colorize_default proc~color_index color_index proc~colorize_default->proc~color_index proc~upper upper proc~colorize_default->proc~upper proc~style_index style_index proc~colorize_default->proc~style_index

Contents

Source Code


Source Code

   pure function colorize_str(self, color_fg, color_bg, style) result(colorized)
   !< Colorize and stylize strings, DEFAULT kind.
   !<
   !<```fortran
   !< type(string) :: astring
   !< astring = 'say all Hello WorLD!'
   !< print '(L1)', astring%colorize(color_fg='red')=='say all Hello WorLD!'
   !<```
   !=> T <<<
   class(string),    intent(in)           :: self      !< The string.
   character(len=*), intent(in), optional :: color_fg  !< Foreground color definition.
   character(len=*), intent(in), optional :: color_bg  !< Background color definition.
   character(len=*), intent(in), optional :: style     !< Style definition.
   character(len=:), allocatable          :: colorized !< Colorized string.

   colorized = colorize(string=self%chars(), color_fg=color_fg, color_bg=color_bg, style=style)
   endfunction colorize_str