Commit | Line | Data |
---|---|---|
55478183 | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
55478183 | 3 | * |
0235b0db | 4 | * Copyright 2019 Philippe Proulx <pproulx@efficios.com> |
55478183 PP |
5 | */ |
6 | ||
0235b0db MJ |
7 | #ifndef BABELTRACE_PLUGINS_TEXT_DETAILS_COLORS_H |
8 | #define BABELTRACE_PLUGINS_TEXT_DETAILS_COLORS_H | |
9 | ||
55478183 PP |
10 | #include "common/common.h" |
11 | ||
12 | #include "write.h" | |
13 | ||
14 | static inline | |
15 | const char *color_reset(struct details_write_ctx *ctx) | |
16 | { | |
17 | const char *code = ""; | |
18 | ||
19 | if (ctx->details_comp->cfg.with_color) { | |
04609487 | 20 | code = bt_common_color_reset(); |
55478183 PP |
21 | } |
22 | ||
23 | return code; | |
24 | } | |
25 | ||
26 | static inline | |
27 | const char *color_bold(struct details_write_ctx *ctx) | |
28 | { | |
29 | const char *code = ""; | |
30 | ||
31 | if (ctx->details_comp->cfg.with_color) { | |
04609487 | 32 | code = bt_common_color_bold(); |
55478183 PP |
33 | } |
34 | ||
35 | return code; | |
36 | } | |
37 | ||
38 | static inline | |
39 | const char *color_fg_default(struct details_write_ctx *ctx) | |
40 | { | |
41 | const char *code = ""; | |
42 | ||
43 | if (ctx->details_comp->cfg.with_color) { | |
04609487 | 44 | code = bt_common_color_fg_default(); |
55478183 PP |
45 | } |
46 | ||
47 | return code; | |
48 | } | |
49 | ||
50 | static inline | |
51 | const char *color_fg_red(struct details_write_ctx *ctx) | |
52 | { | |
53 | const char *code = ""; | |
54 | ||
55 | if (ctx->details_comp->cfg.with_color) { | |
04609487 | 56 | code = bt_common_color_fg_red(); |
55478183 PP |
57 | } |
58 | ||
59 | return code; | |
60 | } | |
61 | ||
62 | static inline | |
63 | const char *color_fg_green(struct details_write_ctx *ctx) | |
64 | { | |
65 | const char *code = ""; | |
66 | ||
67 | if (ctx->details_comp->cfg.with_color) { | |
04609487 | 68 | code = bt_common_color_fg_green(); |
55478183 PP |
69 | } |
70 | ||
71 | return code; | |
72 | } | |
73 | ||
74 | static inline | |
75 | const char *color_fg_yellow(struct details_write_ctx *ctx) | |
76 | { | |
77 | const char *code = ""; | |
78 | ||
79 | if (ctx->details_comp->cfg.with_color) { | |
04609487 | 80 | code = bt_common_color_fg_yellow(); |
55478183 PP |
81 | } |
82 | ||
83 | return code; | |
84 | } | |
85 | ||
86 | static inline | |
87 | const char *color_fg_blue(struct details_write_ctx *ctx) | |
88 | { | |
89 | const char *code = ""; | |
90 | ||
91 | if (ctx->details_comp->cfg.with_color) { | |
04609487 | 92 | code = bt_common_color_fg_blue(); |
55478183 PP |
93 | } |
94 | ||
95 | return code; | |
96 | } | |
97 | ||
98 | static inline | |
99 | const char *color_fg_magenta(struct details_write_ctx *ctx) | |
100 | { | |
101 | const char *code = ""; | |
102 | ||
103 | if (ctx->details_comp->cfg.with_color) { | |
04609487 | 104 | code = bt_common_color_fg_magenta(); |
55478183 PP |
105 | } |
106 | ||
107 | return code; | |
108 | } | |
109 | ||
110 | static inline | |
111 | const char *color_fg_cyan(struct details_write_ctx *ctx) | |
112 | { | |
113 | const char *code = ""; | |
114 | ||
115 | if (ctx->details_comp->cfg.with_color) { | |
04609487 | 116 | code = bt_common_color_fg_cyan(); |
55478183 PP |
117 | } |
118 | ||
119 | return code; | |
120 | } | |
121 | ||
122 | static inline | |
123 | const char *color_fg_light_gray(struct details_write_ctx *ctx) | |
124 | { | |
125 | const char *code = ""; | |
126 | ||
127 | if (ctx->details_comp->cfg.with_color) { | |
04609487 PP |
128 | code = bt_common_color_fg_light_gray(); |
129 | } | |
130 | ||
131 | return code; | |
132 | } | |
133 | ||
134 | static inline | |
135 | const char *color_fg_bright_red(struct details_write_ctx *ctx) | |
136 | { | |
137 | const char *code = ""; | |
138 | ||
139 | if (ctx->details_comp->cfg.with_color) { | |
140 | code = bt_common_color_fg_bright_red(); | |
141 | } | |
142 | ||
143 | return code; | |
144 | } | |
145 | ||
146 | static inline | |
147 | const char *color_fg_bright_green(struct details_write_ctx *ctx) | |
148 | { | |
149 | const char *code = ""; | |
150 | ||
151 | if (ctx->details_comp->cfg.with_color) { | |
152 | code = bt_common_color_fg_bright_green(); | |
153 | } | |
154 | ||
155 | return code; | |
156 | } | |
157 | ||
158 | static inline | |
159 | const char *color_fg_bright_yellow(struct details_write_ctx *ctx) | |
160 | { | |
161 | const char *code = ""; | |
162 | ||
163 | if (ctx->details_comp->cfg.with_color) { | |
164 | code = bt_common_color_fg_bright_yellow(); | |
165 | } | |
166 | ||
167 | return code; | |
168 | } | |
169 | ||
170 | static inline | |
171 | const char *color_fg_bright_blue(struct details_write_ctx *ctx) | |
172 | { | |
173 | const char *code = ""; | |
174 | ||
175 | if (ctx->details_comp->cfg.with_color) { | |
176 | code = bt_common_color_fg_bright_blue(); | |
177 | } | |
178 | ||
179 | return code; | |
180 | } | |
181 | ||
182 | static inline | |
183 | const char *color_fg_bright_magenta(struct details_write_ctx *ctx) | |
184 | { | |
185 | const char *code = ""; | |
186 | ||
187 | if (ctx->details_comp->cfg.with_color) { | |
188 | code = bt_common_color_fg_bright_magenta(); | |
189 | } | |
190 | ||
191 | return code; | |
192 | } | |
193 | ||
194 | static inline | |
195 | const char *color_fg_bright_cyan(struct details_write_ctx *ctx) | |
196 | { | |
197 | const char *code = ""; | |
198 | ||
199 | if (ctx->details_comp->cfg.with_color) { | |
200 | code = bt_common_color_fg_bright_cyan(); | |
201 | } | |
202 | ||
203 | return code; | |
204 | } | |
205 | ||
206 | static inline | |
207 | const char *color_fg_bright_light_gray(struct details_write_ctx *ctx) | |
208 | { | |
209 | const char *code = ""; | |
210 | ||
211 | if (ctx->details_comp->cfg.with_color) { | |
212 | code = bt_common_color_fg_bright_light_gray(); | |
55478183 PP |
213 | } |
214 | ||
215 | return code; | |
216 | } | |
217 | ||
218 | static inline | |
219 | const char *color_bg_default(struct details_write_ctx *ctx) | |
220 | { | |
221 | const char *code = ""; | |
222 | ||
223 | if (ctx->details_comp->cfg.with_color) { | |
04609487 | 224 | code = bt_common_color_bg_default(); |
55478183 PP |
225 | } |
226 | ||
227 | return code; | |
228 | } | |
229 | ||
230 | static inline | |
231 | const char *color_bg_red(struct details_write_ctx *ctx) | |
232 | { | |
233 | const char *code = ""; | |
234 | ||
235 | if (ctx->details_comp->cfg.with_color) { | |
04609487 | 236 | code = bt_common_color_bg_red(); |
55478183 PP |
237 | } |
238 | ||
239 | return code; | |
240 | } | |
241 | ||
242 | static inline | |
243 | const char *color_bg_green(struct details_write_ctx *ctx) | |
244 | { | |
245 | const char *code = ""; | |
246 | ||
247 | if (ctx->details_comp->cfg.with_color) { | |
04609487 | 248 | code = bt_common_color_bg_green(); |
55478183 PP |
249 | } |
250 | ||
251 | return code; | |
252 | } | |
253 | ||
254 | static inline | |
255 | const char *color_bg_yellow(struct details_write_ctx *ctx) | |
256 | { | |
257 | const char *code = ""; | |
258 | ||
259 | if (ctx->details_comp->cfg.with_color) { | |
04609487 | 260 | code = bt_common_color_bg_yellow(); |
55478183 PP |
261 | } |
262 | ||
263 | return code; | |
264 | } | |
265 | ||
266 | static inline | |
267 | const char *color_bg_blue(struct details_write_ctx *ctx) | |
268 | { | |
269 | const char *code = ""; | |
270 | ||
271 | if (ctx->details_comp->cfg.with_color) { | |
04609487 | 272 | code = bt_common_color_bg_blue(); |
55478183 PP |
273 | } |
274 | ||
275 | return code; | |
276 | } | |
277 | ||
278 | static inline | |
279 | const char *color_bg_magenta(struct details_write_ctx *ctx) | |
280 | { | |
281 | const char *code = ""; | |
282 | ||
283 | if (ctx->details_comp->cfg.with_color) { | |
04609487 | 284 | code = bt_common_color_bg_magenta(); |
55478183 PP |
285 | } |
286 | ||
287 | return code; | |
288 | } | |
289 | ||
290 | static inline | |
291 | const char *color_bg_cyan(struct details_write_ctx *ctx) | |
292 | { | |
293 | const char *code = ""; | |
294 | ||
295 | if (ctx->details_comp->cfg.with_color) { | |
04609487 | 296 | code = bt_common_color_bg_cyan(); |
55478183 PP |
297 | } |
298 | ||
299 | return code; | |
300 | } | |
301 | ||
302 | static inline | |
303 | const char *color_bg_light_gray(struct details_write_ctx *ctx) | |
304 | { | |
305 | const char *code = ""; | |
306 | ||
307 | if (ctx->details_comp->cfg.with_color) { | |
04609487 | 308 | code = bt_common_color_bg_light_gray(); |
55478183 PP |
309 | } |
310 | ||
311 | return code; | |
312 | } | |
313 | ||
314 | #endif /* BABELTRACE_PLUGINS_TEXT_DETAILS_COLORS_H */ |