face Module

FACE, Fortran Ansi Colors Environment.


Uses

  • module~~face~~UsesGraph module~face face iso_fortran_env iso_fortran_env module~face->iso_fortran_env

Used by

  • module~~face~~UsedByGraph module~face face program~face_test_basic face_test_basic program~face_test_basic->module~face program~face_test_colors face_test_colors program~face_test_colors->module~face program~face_test_styles face_test_styles program~face_test_styles->module~face program~face_test_ucs4 face_test_ucs4 program~face_test_ucs4->module~face

Contents


Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: ASCII = selected_char_kind('default')

ASCII character set kind.

integer, public, parameter :: UCS4 = selected_char_kind('default')

Unicode character set kind.

character(len=26), private, parameter :: UPPER_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

Upper case alphabet.

character(len=26), private, parameter :: LOWER_ALPHABET = 'abcdefghijklmnopqrstuvwxyz'

Lower case alphabet.

character(len=1), private, parameter :: NL = new_line('a')

New line character.

character(len=1), private, parameter :: ESCAPE = achar(27)

“" character.

character(len=2), private, parameter :: CODE_START = ESCAPE//'['

Start ansi code, “[“.

character(len=1), private, parameter :: CODE_END = 'm'

End ansi code, “m”.

character(len=4), private, parameter :: CODE_CLEAR = CODE_START//'0'//CODE_END

Clear all styles, “[0m”.

character(len=17), private, parameter :: STYLES(1:2,1:16) = reshape(['BOLD_ON          ', '1                ', 'ITALICS_ON       ', '3                ', 'UNDERLINE_ON     ', '4                ', 'INVERSE_ON       ', '7                ', 'STRIKETHROUGH_ON ', '9                ', 'BOLD_OFF         ', '22               ', 'ITALICS_OFF      ', '23               ', 'UNDERLINE_OFF    ', '24               ', 'INVERSE_OFF      ', '27               ', 'STRIKETHROUGH_OFF', '29               ', 'FRAMED_ON        ', '51               ', 'ENCIRCLED_ON     ', '52               ', 'OVERLINED_ON     ', '53               ', 'FRAMED_OFF       ', '54               ', 'ENCIRCLED_OFF    ', '54               ', 'OVERLINED_OFF    ', '55               '], [2, 16])

Styles.

character(len=15), private, parameter :: COLORS_FG(1:2,1:17) = reshape(['BLACK          ', '30             ', 'RED            ', '31             ', 'GREEN          ', '32             ', 'YELLOW         ', '33             ', 'BLUE           ', '34             ', 'MAGENTA        ', '35             ', 'CYAN           ', '36             ', 'WHITE          ', '37             ', 'DEFAULT        ', '39             ', 'BLACK_INTENSE  ', '90             ', 'RED_INTENSE    ', '91             ', 'GREEN_INTENSE  ', '92             ', 'YELLOW_INTENSE ', '93             ', 'BLUE_INTENSE   ', '94             ', 'MAGENTA_INTENSE', '95             ', 'CYAN_INTENSE   ', '96             ', 'WHITE_INTENSE  ', '97             '], [2, 17])

Foreground colors.

character(len=15), private, parameter :: COLORS_BG(1:2,1:17) = reshape(['BLACK          ', '40             ', 'RED            ', '41             ', 'GREEN          ', '42             ', 'YELLOW         ', '43             ', 'BLUE           ', '44             ', 'MAGENTA        ', '45             ', 'CYAN           ', '46             ', 'WHITE          ', '47             ', 'DEFAULT        ', '49             ', 'BLACK_INTENSE  ', '100            ', 'RED_INTENSE    ', '101            ', 'GREEN_INTENSE  ', '102            ', 'YELLOW_INTENSE ', '103            ', 'BLUE_INTENSE   ', '104            ', 'MAGENTA_INTENSE', '105            ', 'CYAN_INTENSE   ', '106            ', 'WHITE_INTENSE  ', '107            '], [2, 17])

Background colors.


Interfaces

public interface colorize

  • private pure function colorize_default(string, color_fg, color_bg, style) result(colorized)

    Colorize and stylize strings, DEFAULT kind.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string

    Input 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.

    Return Value character(len=:), allocatable

    Colorized string.


Functions

private pure function colorize_ascii(string, color_fg, color_bg, style) result(colorized)

Colorize and stylize strings, ASCII kind.

Arguments

Type IntentOptional Attributes Name
character(kind=ASCII, len=*), intent(in) :: string

Input 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.

Return Value character(kind=ASCII, len=:), allocatable

Colorized string.

private pure function colorize_default(string, color_fg, color_bg, style) result(colorized)

Colorize and stylize strings, DEFAULT kind.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string

Input 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.

Return Value character(len=:), allocatable

Colorized string.

private pure function colorize_ucs4(string, color_fg, color_bg, style) result(colorized)

Colorize and stylize strings, UCS4 kind.

Arguments

Type IntentOptional Attributes Name
character(kind=UCS4, len=*), intent(in) :: string

Input 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.

Return Value character(kind=UCS4, len=:), allocatable

Colorized string.

private elemental function color_index(color)

Return the array-index corresponding to the queried color.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: color

Color definition.

Return Value integer(kind=int32)

Index into the colors arrays.

private elemental function style_index(style)

Return the array-index corresponding to the queried style.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: style

Style definition.

Return Value integer(kind=int32)

Index into the styles array.

private elemental function upper(string)

Return a string with all uppercase characters.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string

Input string.

Return Value character(len=len)

Upper case string.


Subroutines

public subroutine colors_samples()

Print to standard output all colors samples.

Arguments

None

public subroutine styles_samples()

Print to standard output all styles samples.

Arguments

None