1 /*
2  * GNT - The GLib Ncurses Toolkit
3  *
4  * GNT is the legal property of its developers, whose names are too numerous
5  * to list here.  Please refer to the COPYRIGHT file distributed with this
6  * source distribution.
7  *
8  * This library is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
21  */
22 
23 #ifndef GNT_COLORS_H
24 #define GNT_COLORS_H
25 /**
26  * SECTION:gntcolors
27  * @section_id: libgnt-gntcolors
28  * @title: Colors
29  * @short_description: Managing and parsing colors
30  */
31 
32 #include <glib.h>
33 
34 /**
35  * GntColorType:
36  *
37  * Different classes of colors.
38  */
39 typedef enum
40 {
41 	GNT_COLOR_NORMAL = 1,
42 	GNT_COLOR_HIGHLIGHT,		/* eg. when a button is selected */
43 	GNT_COLOR_DISABLED,		/* eg. when a button is disabled */
44 	GNT_COLOR_HIGHLIGHT_D,	/* eg. when a button is selected, but some other window is in focus */
45 	GNT_COLOR_TEXT_NORMAL,
46 	GNT_COLOR_TEXT_INACTIVE,	/* when the entry is out of focus */
47 	GNT_COLOR_MNEMONIC,
48 	GNT_COLOR_MNEMONIC_D,
49 	GNT_COLOR_SHADOW,
50 	GNT_COLOR_TITLE,
51 	GNT_COLOR_TITLE_D,
52 	GNT_COLOR_URGENT,       /* this is for the 'urgent' windows */
53 	GNT_COLORS
54 } GntColorType;
55 
56 enum
57 {
58 	GNT_COLOR_BLACK = 0,
59 	GNT_COLOR_RED,
60 	GNT_COLOR_GREEN,
61 	GNT_COLOR_BLUE,
62 	GNT_COLOR_WHITE,
63 	GNT_COLOR_GRAY,
64 	GNT_COLOR_DARK_GRAY,
65 	GNT_TOTAL_COLORS
66 };
67 
68 /**
69  * gnt_init_colors:
70  *
71  * Initialize the colors.
72  */
73 void gnt_init_colors(void);
74 
75 /**
76  * gnt_uninit_colors:
77  *
78  * Uninitialize the colors.
79  */
80 void gnt_uninit_colors(void);
81 
82 /**
83  * gnt_colors_parse:
84  * @kfile:  The file containing color information.
85  *
86  * Parse color information from a file.
87  */
88 void gnt_colors_parse(GKeyFile *kfile);
89 
90 /**
91  * gnt_color_pairs_parse:
92  * @kfile: The file containing the color-pair information.
93  *
94  * Parse color-pair information from a file.
95  */
96 void gnt_color_pairs_parse(GKeyFile *kfile);
97 
98 /**
99  * gnt_colors_get_color:
100  * @key: The string value
101  *
102  * Parse a string color
103  *
104  * Returns: A color. For an unknown color name, returns -EINVAL.
105  *
106  * Since: 2.4.0
107  */
108 int gnt_colors_get_color(char *key);
109 
110 /**
111  * gnt_color_pair:
112  * @color:   The color code.
113  *
114  * Return the appropriate character attribute for a specified color.
115  * If the terminal doesn't have color support, this returns A_STANDOUT
116  * when deemed appropriate.
117  *
118  * Returns:  A character attribute.
119  *
120  * Since: 2.3.0
121  */
122 int gnt_color_pair(int color);
123 
124 /**
125  * gnt_color_add_pair:
126  * @fg:   Foreground
127  * @bg:   Background
128  *
129  * Adds a color definition
130  *
131  * Returns:  A color pair
132  *
133  * Since: 2.4.0
134  */
135 int gnt_color_add_pair(int fg, int bg);
136 
137 #endif
138