1 #ifndef BABELTRACE_PLUGINS_TEXT_DETAILS_COLORS_H
2 #define BABELTRACE_PLUGINS_TEXT_DETAILS_COLORS_H
5 * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
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:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
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
26 #include "common/common.h"
31 const char *color_reset(struct details_write_ctx
*ctx
)
33 const char *code
= "";
35 if (ctx
->details_comp
->cfg
.with_color
) {
36 code
= BT_COMMON_COLOR_RESET
;
43 const char *color_bold(struct details_write_ctx
*ctx
)
45 const char *code
= "";
47 if (ctx
->details_comp
->cfg
.with_color
) {
48 code
= BT_COMMON_COLOR_BOLD
;
55 const char *color_fg_default(struct details_write_ctx
*ctx
)
57 const char *code
= "";
59 if (ctx
->details_comp
->cfg
.with_color
) {
60 code
= BT_COMMON_COLOR_FG_DEFAULT
;
67 const char *color_fg_red(struct details_write_ctx
*ctx
)
69 const char *code
= "";
71 if (ctx
->details_comp
->cfg
.with_color
) {
72 code
= BT_COMMON_COLOR_FG_RED
;
79 const char *color_fg_green(struct details_write_ctx
*ctx
)
81 const char *code
= "";
83 if (ctx
->details_comp
->cfg
.with_color
) {
84 code
= BT_COMMON_COLOR_FG_GREEN
;
91 const char *color_fg_yellow(struct details_write_ctx
*ctx
)
93 const char *code
= "";
95 if (ctx
->details_comp
->cfg
.with_color
) {
96 code
= BT_COMMON_COLOR_FG_YELLOW
;
103 const char *color_fg_blue(struct details_write_ctx
*ctx
)
105 const char *code
= "";
107 if (ctx
->details_comp
->cfg
.with_color
) {
108 code
= BT_COMMON_COLOR_FG_BLUE
;
115 const char *color_fg_magenta(struct details_write_ctx
*ctx
)
117 const char *code
= "";
119 if (ctx
->details_comp
->cfg
.with_color
) {
120 code
= BT_COMMON_COLOR_FG_MAGENTA
;
127 const char *color_fg_cyan(struct details_write_ctx
*ctx
)
129 const char *code
= "";
131 if (ctx
->details_comp
->cfg
.with_color
) {
132 code
= BT_COMMON_COLOR_FG_CYAN
;
139 const char *color_fg_light_gray(struct details_write_ctx
*ctx
)
141 const char *code
= "";
143 if (ctx
->details_comp
->cfg
.with_color
) {
144 code
= BT_COMMON_COLOR_FG_LIGHT_GRAY
;
151 const char *color_bg_default(struct details_write_ctx
*ctx
)
153 const char *code
= "";
155 if (ctx
->details_comp
->cfg
.with_color
) {
156 code
= BT_COMMON_COLOR_BG_DEFAULT
;
163 const char *color_bg_red(struct details_write_ctx
*ctx
)
165 const char *code
= "";
167 if (ctx
->details_comp
->cfg
.with_color
) {
168 code
= BT_COMMON_COLOR_BG_RED
;
175 const char *color_bg_green(struct details_write_ctx
*ctx
)
177 const char *code
= "";
179 if (ctx
->details_comp
->cfg
.with_color
) {
180 code
= BT_COMMON_COLOR_BG_GREEN
;
187 const char *color_bg_yellow(struct details_write_ctx
*ctx
)
189 const char *code
= "";
191 if (ctx
->details_comp
->cfg
.with_color
) {
192 code
= BT_COMMON_COLOR_BG_YELLOW
;
199 const char *color_bg_blue(struct details_write_ctx
*ctx
)
201 const char *code
= "";
203 if (ctx
->details_comp
->cfg
.with_color
) {
204 code
= BT_COMMON_COLOR_BG_BLUE
;
211 const char *color_bg_magenta(struct details_write_ctx
*ctx
)
213 const char *code
= "";
215 if (ctx
->details_comp
->cfg
.with_color
) {
216 code
= BT_COMMON_COLOR_BG_MAGENTA
;
223 const char *color_bg_cyan(struct details_write_ctx
*ctx
)
225 const char *code
= "";
227 if (ctx
->details_comp
->cfg
.with_color
) {
228 code
= BT_COMMON_COLOR_BG_CYAN
;
235 const char *color_bg_light_gray(struct details_write_ctx
*ctx
)
237 const char *code
= "";
239 if (ctx
->details_comp
->cfg
.with_color
) {
240 code
= BT_COMMON_COLOR_BG_LIGHT_GRAY
;
246 #endif /* BABELTRACE_PLUGINS_TEXT_DETAILS_COLORS_H */