MOS Source Code
Loading...
Searching...
No Matches
libs.AnsiColors

ANSI color codes. More...

+ Collaboration diagram for libs.AnsiColors:

Macros

#define STD_COLOR_LIGHT   0x8
 
#define ANSI_COLOR(...)
 ANSI color codes creator.
 
#define ANSI_COLOR_RESET   "\033[0m"
 
#define _ANSI_FG   "3"
 
#define _ANSI_BG   "4"
 
#define _ANSI_COLOR_black   "0"
 
#define _ANSI_COLOR_red   "1"
 
#define _ANSI_COLOR_green   "2"
 
#define _ANSI_COLOR_yellow   "3"
 
#define _ANSI_COLOR_blue   "4"
 
#define _ANSI_COLOR_magenta   "5"
 
#define _ANSI_COLOR_cyan   "6"
 
#define _ANSI_COLOR_white   "7"
 
#define _ANSI_STYLE_regular   "0"
 
#define _ANSI_STYLE_bright   "1"
 
#define _ANSI_STYLE_faint   "2"
 
#define _ANSI_STYLE_italic   "3"
 
#define _ANSI_STYLE_underline   "4"
 
#define _ANSI_STYLE_blink   "5"
 
#define _ANSI_STYLE_blink_fast   "6"
 
#define _ANSI_STYLE_reverse   "7"
 
#define _ANSI_STYLE_invisible   "8"
 
#define _ANSI_COLOR_1(fg)
 
#define _ANSI_COLOR_2(fg, style)
 
#define _ANSI_COLOR_3(fg, style, bg)
 
#define _ANSI_COLOR_N(_1, _2, _3, N, ...)
 

Enumerations

enum  standard_color_t {
  Black = 0x0 , Blue = 0x1 , Green = 0x2 , Cyan = 0x3 ,
  Red = 0x4 , Magenta = 0x5 , Brown = 0x6 , Gray = 0x7 ,
  DarkGray = Black | 0x8 , LightBlue = Blue | 0x8 , LightGreen = Green | 0x8 , LightCyan = Cyan | 0x8 ,
  LightRed = Red | 0x8 , LightMagenta = Magenta | 0x8 , Yellow = Brown | 0x8 , White = Gray | 0x8
}
 

Functions

should_inline void get_ansi_color (char *buf, standard_color_t fg, standard_color_t bg)
 

Detailed Description

ANSI color codes.

Macro Definition Documentation

◆ STD_COLOR_LIGHT

#define STD_COLOR_LIGHT   0x8

Definition at line 15 of file ansi_colors.h.

◆ ANSI_COLOR

#define ANSI_COLOR ( ...)
Value:
"\033[" _ANSI_COLOR_N(__VA_ARGS__, _ANSI_COLOR_3, _ANSI_COLOR_2, _ANSI_COLOR_1, _)(__VA_ARGS__) "m"
#define _ANSI_COLOR_3(fg, style, bg)
Definition ansi_colors.h:77
#define _ANSI_COLOR_N(_1, _2, _3, N,...)
Definition ansi_colors.h:78
#define _ANSI_COLOR_2(fg, style)
Definition ansi_colors.h:76
#define _ANSI_COLOR_1(fg)
Definition ansi_colors.h:75

ANSI color codes creator.

Usage:

Definition at line 48 of file ansi_colors.h.

Referenced by get_ansi_color().

◆ ANSI_COLOR_RESET

#define ANSI_COLOR_RESET   "\033[0m"

Definition at line 49 of file ansi_colors.h.

Referenced by sbi_console_set_color(), and serial_console_set_color().

◆ _ANSI_FG

#define _ANSI_FG   "3"

Definition at line 53 of file ansi_colors.h.

◆ _ANSI_BG

#define _ANSI_BG   "4"

Definition at line 54 of file ansi_colors.h.

◆ _ANSI_COLOR_black

#define _ANSI_COLOR_black   "0"

Definition at line 56 of file ansi_colors.h.

◆ _ANSI_COLOR_red

#define _ANSI_COLOR_red   "1"

Definition at line 57 of file ansi_colors.h.

◆ _ANSI_COLOR_green

#define _ANSI_COLOR_green   "2"

Definition at line 58 of file ansi_colors.h.

◆ _ANSI_COLOR_yellow

#define _ANSI_COLOR_yellow   "3"

Definition at line 59 of file ansi_colors.h.

◆ _ANSI_COLOR_blue

#define _ANSI_COLOR_blue   "4"

Definition at line 60 of file ansi_colors.h.

◆ _ANSI_COLOR_magenta

#define _ANSI_COLOR_magenta   "5"

Definition at line 61 of file ansi_colors.h.

◆ _ANSI_COLOR_cyan

#define _ANSI_COLOR_cyan   "6"

Definition at line 62 of file ansi_colors.h.

◆ _ANSI_COLOR_white

#define _ANSI_COLOR_white   "7"

Definition at line 63 of file ansi_colors.h.

◆ _ANSI_STYLE_regular

#define _ANSI_STYLE_regular   "0"

Definition at line 65 of file ansi_colors.h.

◆ _ANSI_STYLE_bright

#define _ANSI_STYLE_bright   "1"

Definition at line 66 of file ansi_colors.h.

◆ _ANSI_STYLE_faint

#define _ANSI_STYLE_faint   "2"

Definition at line 67 of file ansi_colors.h.

◆ _ANSI_STYLE_italic

#define _ANSI_STYLE_italic   "3"

Definition at line 68 of file ansi_colors.h.

◆ _ANSI_STYLE_underline

#define _ANSI_STYLE_underline   "4"

Definition at line 69 of file ansi_colors.h.

◆ _ANSI_STYLE_blink

#define _ANSI_STYLE_blink   "5"

Definition at line 70 of file ansi_colors.h.

◆ _ANSI_STYLE_blink_fast

#define _ANSI_STYLE_blink_fast   "6"

Definition at line 71 of file ansi_colors.h.

◆ _ANSI_STYLE_reverse

#define _ANSI_STYLE_reverse   "7"

Definition at line 72 of file ansi_colors.h.

◆ _ANSI_STYLE_invisible

#define _ANSI_STYLE_invisible   "8"

Definition at line 73 of file ansi_colors.h.

◆ _ANSI_COLOR_1

#define _ANSI_COLOR_1 ( fg)
Value:
_ANSI_FG _ANSI_COLOR_##fg
#define _ANSI_FG
Definition ansi_colors.h:53

Definition at line 75 of file ansi_colors.h.

◆ _ANSI_COLOR_2

#define _ANSI_COLOR_2 ( fg,
style )
Value:
_ANSI_STYLE_##style ";" _ANSI_FG _ANSI_COLOR_##fg

Definition at line 76 of file ansi_colors.h.

◆ _ANSI_COLOR_3

#define _ANSI_COLOR_3 ( fg,
style,
bg )
Value:
_ANSI_STYLE_##style ";" _ANSI_FG _ANSI_COLOR_##fg ";" _ANSI_BG _ANSI_COLOR_##bg
#define _ANSI_BG
Definition ansi_colors.h:54

Definition at line 77 of file ansi_colors.h.

◆ _ANSI_COLOR_N

#define _ANSI_COLOR_N ( _1,
_2,
_3,
N,
... )
Value:
N

Definition at line 78 of file ansi_colors.h.

Enumeration Type Documentation

◆ standard_color_t

Enumerator
Black 
Blue 
Green 
Cyan 
Red 
Magenta 
Brown 
Gray 
DarkGray 
LightBlue 
LightGreen 
LightCyan 
LightRed 
LightMagenta 
Yellow 
White 

Definition at line 17 of file ansi_colors.h.

Function Documentation

◆ get_ansi_color()

should_inline void get_ansi_color ( char * buf,
standard_color_t fg,
standard_color_t bg )

Definition at line 80 of file ansi_colors.h.

Referenced by sbi_console_set_color(), and serial_console_set_color().

+ Here is the call graph for this function: