2 * $Id: color.h 1012 2008-03-26 00:44:22Z hubert@u.washington.edu $
4 * ========================================================================
5 * Copyright 2013-2022 Eduardo Chappa
6 * Copyright 2006-2008 University of Washington
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * ========================================================================
17 #ifndef PITH_OSDEP_COLOR_INCLUDED
18 #define PITH_OSDEP_COLOR_INCLUDED
22 #define MAXCOLORLEN 11 /* longest string a color can be */
24 typedef struct COLOR_PAIR
{
25 char fg
[MAXCOLORLEN
+1];
26 char bg
[MAXCOLORLEN
+1];
38 #define DEFAULT_NORM_FORE_RGB "000,000,000"
39 #define DEFAULT_NORM_BACK_RGB "255,255,255"
41 /* flags for pico_set_color() */
45 #define PSC_RET 0x4 /* return an allocated copy of previous color */
49 * MATCH_NORM_COLOR means that the color that is set to this value
50 * will actually use the corresponding fg or bg color from the
51 * so called Normal Color. A MATCH_NONE_COLOR means that the
52 * corresponding fg or bg color will just be left alone, so that
53 * it will stay the same as it was. This is useful when you want
54 * to change the foreground color but let the background match
55 * whatever it was before, for example in colored index lines.
57 * Note: these need to be RGBLEN in length because they are sometimes
58 * used in places where an RGB value is expected.
60 #define MATCH_NORM_COLOR "norm_padded"
61 #define MATCH_NONE_COLOR "none_padded"
63 #define MATCH_TRAN_COLOR "transparent"
66 /* exported prototypes */
67 COLOR_PAIR
*new_color_pair(char *, char *);
68 void free_color_pair(COLOR_PAIR
**cp
);
69 int pico_is_good_colorpair(COLOR_PAIR
*);
70 COLOR_PAIR
*pico_set_colorp(COLOR_PAIR
*, int);
73 /* required prototypes (os/app dependent ) */
74 int pico_usingcolor(void);
75 int pico_hascolor(void);
77 char *color_to_asciirgb(char *);
78 int pico_is_good_color(char *);
79 COLOR_PAIR
*pico_set_colors(char *, char *, int);
80 int pico_set_fg_color(char *);
81 int pico_set_bg_color(char *);
82 void pico_nfcolor(char *);
83 void pico_nbcolor(char *);
84 void pico_rfcolor(char *);
85 void pico_rbcolor(char *);
86 COLOR_PAIR
*pico_get_cur_color(void);
87 COLOR_PAIR
*pico_get_rev_color(void);
88 void pico_set_normal_color(void);
89 void pico_set_color_options(unsigned);
90 unsigned pico_get_color_options(void);
91 int pico_trans_is_on(void);
92 char *pico_get_last_fg_color(void);
93 char *pico_get_last_bg_color(void);
94 char *color_to_canonical_name(char *);
95 int pico_count_in_color_table(void);
98 #endif /* PITH_OSDEP_COLOR_INCLUDED */