304708052d31be5068a1b0ad5d9f5214df6f5761
[babeltrace.git] / src / plugins / text / details / colors.h
1 #ifndef BABELTRACE_PLUGINS_TEXT_DETAILS_COLORS_H
2 #define BABELTRACE_PLUGINS_TEXT_DETAILS_COLORS_H
3
4 /*
5 * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 */
25
26 #include "common/common.h"
27
28 #include "write.h"
29
30 static inline
31 const char *color_reset(struct details_write_ctx *ctx)
32 {
33 const char *code = "";
34
35 if (ctx->details_comp->cfg.with_color) {
36 code = bt_common_color_reset();
37 }
38
39 return code;
40 }
41
42 static inline
43 const char *color_bold(struct details_write_ctx *ctx)
44 {
45 const char *code = "";
46
47 if (ctx->details_comp->cfg.with_color) {
48 code = bt_common_color_bold();
49 }
50
51 return code;
52 }
53
54 static inline
55 const char *color_fg_default(struct details_write_ctx *ctx)
56 {
57 const char *code = "";
58
59 if (ctx->details_comp->cfg.with_color) {
60 code = bt_common_color_fg_default();
61 }
62
63 return code;
64 }
65
66 static inline
67 const char *color_fg_red(struct details_write_ctx *ctx)
68 {
69 const char *code = "";
70
71 if (ctx->details_comp->cfg.with_color) {
72 code = bt_common_color_fg_red();
73 }
74
75 return code;
76 }
77
78 static inline
79 const char *color_fg_green(struct details_write_ctx *ctx)
80 {
81 const char *code = "";
82
83 if (ctx->details_comp->cfg.with_color) {
84 code = bt_common_color_fg_green();
85 }
86
87 return code;
88 }
89
90 static inline
91 const char *color_fg_yellow(struct details_write_ctx *ctx)
92 {
93 const char *code = "";
94
95 if (ctx->details_comp->cfg.with_color) {
96 code = bt_common_color_fg_yellow();
97 }
98
99 return code;
100 }
101
102 static inline
103 const char *color_fg_blue(struct details_write_ctx *ctx)
104 {
105 const char *code = "";
106
107 if (ctx->details_comp->cfg.with_color) {
108 code = bt_common_color_fg_blue();
109 }
110
111 return code;
112 }
113
114 static inline
115 const char *color_fg_magenta(struct details_write_ctx *ctx)
116 {
117 const char *code = "";
118
119 if (ctx->details_comp->cfg.with_color) {
120 code = bt_common_color_fg_magenta();
121 }
122
123 return code;
124 }
125
126 static inline
127 const char *color_fg_cyan(struct details_write_ctx *ctx)
128 {
129 const char *code = "";
130
131 if (ctx->details_comp->cfg.with_color) {
132 code = bt_common_color_fg_cyan();
133 }
134
135 return code;
136 }
137
138 static inline
139 const char *color_fg_light_gray(struct details_write_ctx *ctx)
140 {
141 const char *code = "";
142
143 if (ctx->details_comp->cfg.with_color) {
144 code = bt_common_color_fg_light_gray();
145 }
146
147 return code;
148 }
149
150 static inline
151 const char *color_fg_bright_red(struct details_write_ctx *ctx)
152 {
153 const char *code = "";
154
155 if (ctx->details_comp->cfg.with_color) {
156 code = bt_common_color_fg_bright_red();
157 }
158
159 return code;
160 }
161
162 static inline
163 const char *color_fg_bright_green(struct details_write_ctx *ctx)
164 {
165 const char *code = "";
166
167 if (ctx->details_comp->cfg.with_color) {
168 code = bt_common_color_fg_bright_green();
169 }
170
171 return code;
172 }
173
174 static inline
175 const char *color_fg_bright_yellow(struct details_write_ctx *ctx)
176 {
177 const char *code = "";
178
179 if (ctx->details_comp->cfg.with_color) {
180 code = bt_common_color_fg_bright_yellow();
181 }
182
183 return code;
184 }
185
186 static inline
187 const char *color_fg_bright_blue(struct details_write_ctx *ctx)
188 {
189 const char *code = "";
190
191 if (ctx->details_comp->cfg.with_color) {
192 code = bt_common_color_fg_bright_blue();
193 }
194
195 return code;
196 }
197
198 static inline
199 const char *color_fg_bright_magenta(struct details_write_ctx *ctx)
200 {
201 const char *code = "";
202
203 if (ctx->details_comp->cfg.with_color) {
204 code = bt_common_color_fg_bright_magenta();
205 }
206
207 return code;
208 }
209
210 static inline
211 const char *color_fg_bright_cyan(struct details_write_ctx *ctx)
212 {
213 const char *code = "";
214
215 if (ctx->details_comp->cfg.with_color) {
216 code = bt_common_color_fg_bright_cyan();
217 }
218
219 return code;
220 }
221
222 static inline
223 const char *color_fg_bright_light_gray(struct details_write_ctx *ctx)
224 {
225 const char *code = "";
226
227 if (ctx->details_comp->cfg.with_color) {
228 code = bt_common_color_fg_bright_light_gray();
229 }
230
231 return code;
232 }
233
234 static inline
235 const char *color_bg_default(struct details_write_ctx *ctx)
236 {
237 const char *code = "";
238
239 if (ctx->details_comp->cfg.with_color) {
240 code = bt_common_color_bg_default();
241 }
242
243 return code;
244 }
245
246 static inline
247 const char *color_bg_red(struct details_write_ctx *ctx)
248 {
249 const char *code = "";
250
251 if (ctx->details_comp->cfg.with_color) {
252 code = bt_common_color_bg_red();
253 }
254
255 return code;
256 }
257
258 static inline
259 const char *color_bg_green(struct details_write_ctx *ctx)
260 {
261 const char *code = "";
262
263 if (ctx->details_comp->cfg.with_color) {
264 code = bt_common_color_bg_green();
265 }
266
267 return code;
268 }
269
270 static inline
271 const char *color_bg_yellow(struct details_write_ctx *ctx)
272 {
273 const char *code = "";
274
275 if (ctx->details_comp->cfg.with_color) {
276 code = bt_common_color_bg_yellow();
277 }
278
279 return code;
280 }
281
282 static inline
283 const char *color_bg_blue(struct details_write_ctx *ctx)
284 {
285 const char *code = "";
286
287 if (ctx->details_comp->cfg.with_color) {
288 code = bt_common_color_bg_blue();
289 }
290
291 return code;
292 }
293
294 static inline
295 const char *color_bg_magenta(struct details_write_ctx *ctx)
296 {
297 const char *code = "";
298
299 if (ctx->details_comp->cfg.with_color) {
300 code = bt_common_color_bg_magenta();
301 }
302
303 return code;
304 }
305
306 static inline
307 const char *color_bg_cyan(struct details_write_ctx *ctx)
308 {
309 const char *code = "";
310
311 if (ctx->details_comp->cfg.with_color) {
312 code = bt_common_color_bg_cyan();
313 }
314
315 return code;
316 }
317
318 static inline
319 const char *color_bg_light_gray(struct details_write_ctx *ctx)
320 {
321 const char *code = "";
322
323 if (ctx->details_comp->cfg.with_color) {
324 code = bt_common_color_bg_light_gray();
325 }
326
327 return code;
328 }
329
330 #endif /* BABELTRACE_PLUGINS_TEXT_DETAILS_COLORS_H */
This page took 0.036015 seconds and 3 git commands to generate.