Colors

This module allows to detect color support on terminal and create cached variables to colorize outputs.

Functions

check_color_support

Detect color support of the terminal. This function respect the NO_COLOR env variable (https://no-color.org/).

check_color_support(URL <url>)
VARIABLE <variable>

The variable is set to TRUE if the terminal support color, else return FALSE

colorize

Create cached color and style variables.

colorize()

If colors are supported in terminal, create CMake cached variables containing style and colors escape sequences.

Some colors can be defined using the cmake:envvar::CMMM_COLORS (default=0;35:fatal_error=1;31:error=0;31:warn=0;33:info=0;32).

This function respect the NO_COLOR env variable (https://no-color.org/).

CMCM_DEFAULT_COLOR

Color for default emphase.

CMCM_FATAL_ERROR_COLOR

Color for fatal_error.

CMCM_ERROR_COLOR

Color for error.

CMCM_WARN_COLOR

Color for warning.

CMCM_INFO_COLOR

Color for info.

CMCM_FG_BLACK

Foreground black color.

CMCM_FG_RED

Foreground red color.

CMCM_FG_GREEN

Foreground green color.

CMCM_FG_YELLOW

Foreground yellow color.

CMCM_FG_BLUE

Foreground blue color.

CMCM_FG_MAGENTA

Foreground magenta color.

CMCM_FG_CYAN

Foreground cyan color.

CMCM_FG_WHITE

Foreground white color.

CMCM_FG_BOLD_BLACK

Foreground bold black color.

CMCM_FG_BOLD_RED

Foreground bold red color.

CMCM_FG_BOLD_GREEN

Foreground bold green color.

CMCM_FG_BOLD_YELLOW

Foreground bold yellow color.

CMCM_FG_BOLD_BLUE

Foreground bold blue color.

CMCM_FG_BOLD_MAGENTA

Foreground bold magenta color.

CMCM_FG_BOLD_CYAN

Foreground bold cyan color.

CMCM_FG_BOLD_WHITE

Foreground bold white color.

CMCM_FG_BRIGHT_BLACK

Foreground bright black color.

CMCM_FG_BRIGHT_RED

Foreground bright red color.

CMCM_FG_BRIGTH_GREEN

Foreground bright green color.

CMCM_FG_BRIGHT_YELLOW

Foreground bright yellow color.

CMCM_FG_BRIGHT_BLUE

Foreground bright blue color.

CMCM_FG_BRIGHT_MAGENTA

Foreground bright magenta color.

CMCM_FG_BRIGHT_CYAN

Foreground bright cyan color.

CMCM_FG_BRIGHT_WHITE

Foreground bright white color.

CMCM_BG_BLACK

Background black color.

CMCM_BG_RED

Background red color.

CMCM_BG_GREEN

Background green color.

CMCM_BG_YELLOW

Background yellow color.

CMCM_BG_BLUE

Background blue color.

CMCM_BG_MAGENTA

Background magenta color.

CMCM_BG_CYAN

Background cyan color.

CMCM_BG_WHITE

Background white color.

CMCM_BG_BOLD_BLACK

Background bold black color.

CMCM_BG_BOLD_RED

Background bold red color.

CMCM_BG_BOLD_GREEN

Background bold green color.

CMCM_BG_BOLD_YELLOW

Background bold yellow color.

CMCM_BG_BOLD_BLUE

Background bold blue color.

CMCM_BG_BOLD_MAGENTA

Background bold magenta color.

CMCM_BG_BOLD_CYAN

Background bold cyan color.

CMCM_BG_BOLD_WHITE

Background bold white color.

CMCM_BG_BRIGHT_BLACK

Background bright black color.

CMCM_BG_BRIGHT_RED

Background bright red color.

CMCM_BG_BRIGTH_GREEN

Background bright green color.

CMCM_BG_BRIGHT_YELLOW

Background bright yellow color.

CMCM_BG_BRIGHT_BLUE

Background bright blue color.

CMCM_BG_BRIGHT_MAGENTA

Background bright magenta color.

CMCM_BG_BRIGHT_CYAN

Background bright cyan color.

CMCM_BG_BRIGHT_WHITE

Background bright white color.

CMCM_BOLD

Bold style.

CMCM_FAINT

Faint style.

CMCM_ITALIC

Italic style.

CMCM_UNDERLINE

Underline style.

Blink style.

Rapid blink style.

CMCM_INVERT

Invert style.

CMCM_CONCEAL

Conceal style.

CMCM_CROSSOUT

Crossout style.

CMCM_DOUBLY_UNDERLINE

Doubly underline style.

CMCM_UNBOLD

Disable bold style.

CMCM_UNFAINT

Disable faint style.

CMCM_UNITALIC

Disable italic style.

CMCM_UNUNDERLINE

Disable underline style.

CMCM_UNDOUBLY_UNDERLINE

Disable doubly underline style.

Disable blink style.

Disable rapid blink style.

CMCM_UNINVERT

Disable invert style.

CMCM_UNCONCEAL

Disable conceal style.

CMCM_UNCROSSOUT

Disable crossout style.

CMCM_RESET_STYLE

Reset style and color.

CMCM_DEFAULT_FONT

Reset to default font.

CMCM_FONT1

Font 1.

CMCM_FONT2

Font 2.

CMCM_FONT3

Font 3.

CMCM_FONT4

Font 4.

CMCM_FONT5

Font 5.

CMCM_FONT6

Font 6.

CMCM_FONT7

Font 7.

CMCM_FONT8

Font 8.

CMCM_FONT9

Font 9.

CMCM_FRAKTUR

Fraktur font.