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 module~flap_command_line_argument_t flap_command_line_argument_t module~flap_command_line_argument_t->module~face module~flap_command_line_arguments_group_t flap_command_line_arguments_group_t module~flap_command_line_arguments_group_t->module~face module~flap_command_line_arguments_group_t->module~flap_command_line_argument_t module~flap_command_line_interface_t flap_command_line_interface_t module~flap_command_line_interface_t->module~face module~flap_command_line_interface_t->module~flap_command_line_argument_t module~flap_command_line_interface_t->module~flap_command_line_arguments_group_t 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 module~flap flap module~flap->module~flap_command_line_argument_t module~flap->module~flap_command_line_arguments_group_t module~flap->module~flap_command_line_interface_t program~flap_save_bash_completion flap_save_bash_completion program~flap_save_bash_completion->module~flap program~flap_save_man_page flap_save_man_page program~flap_save_man_page->module~flap program~flap_save_usage_to_markdown flap_save_usage_to_markdown program~flap_save_usage_to_markdown->module~flap program~flap_test_action_store flap_test_action_store program~flap_test_action_store->module~flap program~flap_test_ansi_color_style flap_test_ansi_color_style program~flap_test_ansi_color_style->module~flap program~flap_test_basic flap_test_basic program~flap_test_basic->module~flap program~flap_test_choices_logical flap_test_choices_logical program~flap_test_choices_logical->module~flap program~flap_test_duplicated_clas flap_test_duplicated_clas program~flap_test_duplicated_clas->module~flap program~flap_test_group flap_test_group program~flap_test_group->module~flap program~flap_test_group_examples flap_test_group_examples program~flap_test_group_examples->module~flap program~flap_test_hidden flap_test_hidden program~flap_test_hidden->module~flap program~flap_test_ignore_unknown_clas flap_test_ignore_unknown_clas program~flap_test_ignore_unknown_clas->module~flap program~flap_test_minimal flap_test_minimal program~flap_test_minimal->module~flap program~flap_test_nargs_insufficient flap_test_nargs_insufficient program~flap_test_nargs_insufficient->module~flap program~flap_test_nargs_insufficient~2 flap_test_nargs_insufficient program~flap_test_nargs_insufficient~2->module~flap program~flap_test_nested flap_test_nested program~flap_test_nested->module~flap program~flap_test_string flap_test_string program~flap_test_string->module~flap

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