Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
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')=='[31msay all Hello WorLD![0m'
!<```
!=> 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