Loading...
Searching...
No Matches

ANSI SGR definitions. More...

Detailed Description

ANSI SGR definitions.

Author
Carl Seifert carl..nosp@m.seif.nosp@m.ert@t.nosp@m.u-dr.nosp@m.esden.nosp@m..de

Definition in file ansi_style.h.

#include "macros/xtstr.h"
+ Include dependency graph for ansi_style.h:

Go to the source code of this file.

SGR escape sequence

#define _ANSI_SGR_PREFIX   "\x1b["
 ANSI escape prefix.
 
#define _ANSI_SGR_SUFFIX   "m"
 ANSI color/style suffix.
 

Color codes

#define _ANSI_COLOR_CODE_PRIMARY   "0"
 ANSI color code for primary color (black in light appearance, white in dark)
 
#define _ANSI_COLOR_CODE_BLACK   _ANSI_COLOR_CODE_PRIMARY
 Alias for _ANSI_COLOR_CODE_PRIMARY.
 
#define _ANSI_COLOR_CODE_RED   "1"
 ANSI color code for red.
 
#define _ANSI_COLOR_CODE_GREEN   "2"
 ANSI color code for green.
 
#define _ANSI_COLOR_CODE_YELLOW   "3"
 ANSI color code for yellow.
 
#define _ANSI_COLOR_CODE_BLUE   "4"
 ANSI color code for blue.
 
#define _ANSI_COLOR_CODE_PURPLE   "5"
 ANSI color code for purple (pink, magenta)
 
#define _ANSI_COLOR_CODE_CYAN   "6"
 ANSI color code for cyan (light blue)
 
#define _ANSI_COLOR_CODE_WHITE   "7"
 ANSI color code for white (gray)
 
#define _ANSI_COLOR_CODE_RGB(r, g, b)
 ANSI color code for 24-bit RGB colors.
 
#define _ANSI_COLOR_CODE_INDEXED(index)
 ANSI color code for 8-bit indexed colors.
 

Color modifiers

#define _ANSI_COLOR_MODIFIER_FOREGROUND   "3"
 ANSI modifier to make color apply to foreground text.
 
#define _ANSI_COLOR_MODIFIER_BRIGHT_FOREGROUND   "9"
 ANSI modifier to make color apply to foreground text in high intensity.
 
#define _ANSI_COLOR_MODIFIER_BACKGROUND   "4"
 ANSI modifier to make color apply to background.
 
#define _ANSI_COLOR_MODIFIER_BRIGHT_BACKGROUND   "10"
 ANSI modifier to make color apply to background in high intensity.
 

Color styles

#define ANSI_STYLE_FOREGROUND(color)
 ANSI style for foreground text color.
 
#define ANSI_STYLE_FG(color)
 Alias for ANSI_STYLE_FOREGROUND.
 
#define ANSI_STYLE_FOREGROUND_BRIGHT(color)
 ANSI style for a brighter foreground text color.
 
#define ANSI_STYLE_FG_BRIGHT(color)
 Alias for ANSI_STYLE_FOREGROUND_BRIGHT.
 
#define ANSI_STYLE_BACKGROUND(color)
 ANSI style for foreground text color.
 
#define ANSI_STYLE_BG(color)
 Alias for ANSI_STYLE_BACKGROUND.
 
#define ANSI_STYLE_BACKGROUND_BRIGHT(color)
 ANSI style for a brighter foreground text color.
 
#define ANSI_STYLE_BG_BRIGHT(color)
 Alias for ANSI_STYLE_BACKGROUND_BRIGHT.
 

Text styles

#define ANSI_STYLE_BOLD   "1"
 ANSI style for bold text.
 
#define ANSI_STYLE_DIM   "2"
 ANSI style for dimmer, thinner, less prominent text.
 
#define ANSI_STYLE_ITALIC   "3"
 ANSI style for italic text.
 
#define ANSI_STYLE_UNDERLINED   "4"
 ANSI style for underlined text.
 
#define ANSI_STYLE_BLINK_SLOW   "5"
 ANSI style for slowly blinking text.
 
#define ANSI_STYLE_BLINK_FAST   "6"
 ANSI style for fast-blinking text.
 
#define ANSI_STYLE_NEGATED   "7"
 ANSI style swapping foreground and background color settings.
 
#define ANSI_STYLE_CONCEALED   "8"
 ANSI style for concealed (redacted) text.
 
#define ANSI_STYLE_STRIKETHROUGH   "9"
 ANSI style for crossed out text (strikethrough)
 

Formatting macros

#define ANSI_STYLE(...)
 Builds string literal for a terminal emulator to apply color and text styles to subsequent text.
 
#define ANSI_STYLE_RESET   _ANSI_SGR_PREFIX ANSI_STYLE_NONE _ANSI_SGR_SUFFIX
 Resets text color and style applied previously back to defaults.
 
#define ANSI_STYLED(text, ...)
 Applies ANSI styling but only modifies given text.