|
| 1 | +// |
| 2 | +// ansi-color.h |
| 3 | +// classdumpctl |
| 4 | +// |
| 5 | +// Created by Leptos on 8/24/24. |
| 6 | +// Copyright © 2024 Leptos. All rights reserved. |
| 7 | +// |
| 8 | + |
| 9 | +#ifndef ANSI_COLOR_h |
| 10 | +#define ANSI_COLOR_h |
| 11 | + |
| 12 | +/* ANSI color escapes: |
| 13 | + * "\033[Em" |
| 14 | + * where E is the encoding, and the rest are literals, for example: |
| 15 | + * if 'E' -> "0;30" the full string is "\033[0;30m" |
| 16 | + * E -> "0" for reset |
| 17 | + * |
| 18 | + * E -> "T;MC" |
| 19 | + * T values: |
| 20 | + * 0 for regular |
| 21 | + * 1 for bold |
| 22 | + * 2 for faint |
| 23 | + * 3 for italic |
| 24 | + * 4 for underline |
| 25 | + * M values: |
| 26 | + * 3 for foreground normal |
| 27 | + * 4 for background normal |
| 28 | + * 9 for foreground bright |
| 29 | + * 10 for background bright |
| 30 | + * C values: |
| 31 | + * 0 for black |
| 32 | + * 1 for red |
| 33 | + * 2 for green |
| 34 | + * 3 for yellow |
| 35 | + * 4 for blue |
| 36 | + * 5 for purple |
| 37 | + * 6 for cyan |
| 38 | + * 7 for white |
| 39 | + */ |
| 40 | + |
| 41 | +#define ANSI_GRAPHIC_RENDITION(e) "\033[" e "m" |
| 42 | +#define ANSI_GRAPHIC_RESET_CODE "0" |
| 43 | +#define ANSI_GRAPHIC_COLOR(t, m, c) ANSI_GRAPHIC_RENDITION(t ";" m c) |
| 44 | + |
| 45 | +#define ANSI_GRAPHIC_COLOR_TYPE_REGULAR "0" |
| 46 | +#define ANSI_GRAPHIC_COLOR_TYPE_BOLD "1" |
| 47 | +#define ANSI_GRAPHIC_COLOR_TYPE_FAINT "2" |
| 48 | +#define ANSI_GRAPHIC_COLOR_TYPE_ITALIC "3" |
| 49 | +#define ANSI_GRAPHIC_COLOR_TYPE_UNDERLINE "4" |
| 50 | + |
| 51 | +#define ANSI_GRAPHIC_COLOR_ATTRIBUTE_FOREGROUND_NORMAL "3" |
| 52 | +#define ANSI_GRAPHIC_COLOR_ATTRIBUTE_BACKGROUND_NORMAL "4" |
| 53 | +#define ANSI_GRAPHIC_COLOR_ATTRIBUTE_FOREGROUND_BRIGHT "9" |
| 54 | +#define ANSI_GRAPHIC_COLOR_ATTRIBUTE_BACKGROUND_BRIGHT "10" |
| 55 | + |
| 56 | +#define ANSI_GRAPHIC_COLOR_CODE_BLACK "0" |
| 57 | +#define ANSI_GRAPHIC_COLOR_CODE_RED "1" |
| 58 | +#define ANSI_GRAPHIC_COLOR_CODE_GREEN "2" |
| 59 | +#define ANSI_GRAPHIC_COLOR_CODE_YELLOW "3" |
| 60 | +#define ANSI_GRAPHIC_COLOR_CODE_BLUE "4" |
| 61 | +#define ANSI_GRAPHIC_COLOR_CODE_PURPLE "5" |
| 62 | +#define ANSI_GRAPHIC_COLOR_CODE_CYAN "6" |
| 63 | +#define ANSI_GRAPHIC_COLOR_CODE_WHITE "7" |
| 64 | + |
| 65 | + |
| 66 | +#endif /* ANSI_COLOR_h */ |
0 commit comments