VLC 4.0.0-dev
Loading...
Searching...
No Matches
ansi_term.h
Go to the documentation of this file.
1/*****************************************************************************
2 * ansi_term.h: Common declarations and helpers for ANSI terminal handling
3 *****************************************************************************
4 * Copyright (C) 1998-2011 VLC authors and VideoLAN
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
20
21#ifndef VLC_ANSI_TERM_H
22#define VLC_ANSI_TERM_H 1
23
24#if !defined( _WIN32 )
25# include <termios.h>
26# include <sys/ioctl.h>
27#endif
28
29/* ANSI terminal control ("escape") sequences */
30
31/* Terminal control sequence construction */
32#define term_seq(x) "\033[" #x "m"
33
34/**
35 * Codes:
36 *
37 * Effects:
38 * - Normal: 0 (reset)
39 * - Bold: 1
40 * - Dim: 2
41 * - Italic: 3
42 * - Underline: 4
43 * - Reverse: 7
44 * - Invisible: 8
45 * - Strike: 9 (Strike-through)
46 *
47 * Color set 1:
48 * - Black: 30
49 * - Red 31
50 * - Green 32
51 * - Yellow: 33
52 * - Blue: 34
53 * - Magenta: 35
54 * - Cyan: 36
55 * - White: 37
56 *
57 * Color set 2:
58 * - Black: 90
59 * - Red: 91
60 * - Green: 92
61 * - Yellow: 93
62 * - Blue: 94
63 * - Magenta: 95
64 * - Cyan: 96
65 * - White: 97
66 *
67 * Text background color highlighting, set 1:
68 * - Black: 40
69 * - Red: 41
70 * - Green: 42
71 * - Yellow: 43
72 * - Blue: 44
73 * - Magenta: 45
74 * - Cyan: 46
75 * - White: 47
76 *
77 * Text background color highlighting, set 2:
78 * - Black: 100
79 * - Red: 101
80 * - Green: 102
81 * - Yellow: 103
82 * - Blue: 104
83 * - Magenta: 105
84 * - Cyan: 106
85 * - White: 107
86 */
87
88#define TS_RESET term_seq(0)
89
90#define TS_RESET_BOLD term_seq(0;1)
91
92#define TS_BOLD term_seq(1)
93#define TS_DIM term_seq(2)
94#define TS_ITALIC term_seq(3)
95#define TS_UNDERSCORE term_seq(4)
96#define TS_REVERSE term_seq(7)
97#define TS_INVISIBLE term_seq(8)
98#define TS_STRIKE term_seq(9)
99
100#define TS_BLACK term_seq(30)
101#define TS_RED term_seq(31)
102#define TS_GREEN term_seq(32)
103#define TS_YELLOW term_seq(33)
104#define TS_BLUE term_seq(34)
105#define TS_MAGENTA term_seq(35)
106#define TS_CYAN term_seq(36)
107#define TS_WHITE term_seq(37)
108
109#define TS_BLACK_BOLD term_seq(30;1)
110#define TS_RED_BOLD term_seq(31;1)
111#define TS_GREEN_BOLD term_seq(32;1)
112#define TS_YELLOW_BOLD term_seq(33;1)
113#define TS_BLUE_BOLD term_seq(34;1)
114#define TS_MAGENTA_BOLD term_seq(35;1)
115#define TS_CYAN_BOLD term_seq(36;1)
116#define TS_WHITE_BOLD term_seq(37;1)
117
118#endif