FACE
February 28, 2026 ยท View on GitHub
Fortran Ansi Colors and Styles Environment
A KISS pure Fortran 2008+ library for easy colorizing and stylizing strings with ANSI escape codes โ one function, zero dependencies.
๐จ Single Function APIcolorize(string, color_fg, color_bg, style) โ one call does it all | ๐ Rich Color Support Named colors, 256-color palette, and RGB โ foreground and background | โจ Text Styles Bold, italic, underline, blink, and more standard ANSI styles | ๐ค Unicode Ready Optional UCS4/UTF-8 character kind support via preprocessor |
|---|---|---|---|
| โก Pure Fortran 2008+ No C, no external deps โ tested with gfortran, ifx, lfortran, flang-new, nvfortran | ๐ Multi-licensed GPL v3 ยท BSD 2/3-Clause ยท MIT | ๐ฆ Multiple build systems fpm, FoBiS.py, CMake | ๐ Documented & Tested API reference + full test suite for colors and styles |
For full documentation (guide, API reference, examples, etc.) see the FACE website.
Authors
- Stefano Zaghi โ @szaghi
Contributions are welcome โ see the Contributing page.
Copyrights
This project is distributed under a multi-licensing system:
- FOSS projects: GPL v3
- Closed source / commercial: BSD 2-Clause, BSD 3-Clause, or MIT
Anyone interested in using, developing, or contributing to this project is welcome โ pick the license that best fits your needs.
A taste of FACE
use face
print '(A)', colorize('Hello', color_fg='red')//colorize(' World', color_fg='blue', style='underline_on')
Usage
FACE exposes only 3 procedures:
colorizeโ the main function;colors_samplesโ prints a sample of all available colors to standard output;styles_samplesโ prints a sample of all available styles to standard output.
use face
character(len=:), allocatable :: error_message
error_message = colorize('error:', color_fg='red', style='underline_on')//' file not found!'
print '(A)', error_message
print '(A)', colorize('suggestion: check your configuration', color_fg='blue')
call colors_samples ! print samples of all colors available
call styles_samples ! print samples of all styles available
colorize
colorize returns an allocatable character with the requested foreground color, background color, and style. All arguments except string are optional.
pure function colorize(string, color_fg, color_bg, style) result(colorized)
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.
character(len=:), allocatable :: colorized ! Colorized string.
end function colorize
Colors and style definitions are case insensitive. No warning is returned for unrecognized values โ the color or style is simply not applied.
Available Colors and Styles

Install
FoBiS.py
Standalone โ clone, build, and install in one command:
FoBiS.py install szaghi/FACE -mode static-gnu
FoBiS.py install szaghi/FACE -mode static-gnu --prefix /path/to/prefix
As a project dependency โ declare PENF in your fobos and run fetch:
[dependencies]
deps_dir = src/third_party
FACE = https://github.com/szaghi/FACE
FoBiS.py fetch # fetch and build
FoBiS.py fetch --update # re-fetch and rebuild
fpm
fpm build
fpm test
For dependencies add to your fpm.toml:
[dependencies]
FACE = { git = "https://github.com/szaghi/FACE" }
CMake
cmake -B build && cmake --build build
Makefile
make # static library
make TESTS=yes # build and run tests
Install script
FACE ships a bash script (install.sh, downloadable from the latest release) that automates download and build:
install.sh --download git --build cmake
Supported download methods: git, wget. Supported build systems: fobis, make, cmake.