Update to 24f58c58bb8d22c0e8e6c5ce43c536c47b719bc6
[gnt.git] / gntcolors.h
blob60eb8c899f0df73c6deab624cc3baf325ce9dd48
1 /**
2 * @file gntcolors.h Colors API
3 * @ingroup gnt
4 */
5 /*
6 * GNT - The GLib Ncurses Toolkit
8 * GNT is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
12 * This library is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
27 #ifndef GNT_COLORS_H
28 #define GNT_COLORS_H
30 #include <glib.h>
32 /**
33 * Different classes of colors.
35 typedef enum
37 GNT_COLOR_NORMAL = 1,
38 GNT_COLOR_HIGHLIGHT, /* eg. when a button is selected */
39 GNT_COLOR_DISABLED, /* eg. when a button is disabled */
40 GNT_COLOR_HIGHLIGHT_D, /* eg. when a button is selected, but some other window is in focus */
41 GNT_COLOR_TEXT_NORMAL,
42 GNT_COLOR_TEXT_INACTIVE, /* when the entry is out of focus */
43 GNT_COLOR_MNEMONIC,
44 GNT_COLOR_MNEMONIC_D,
45 GNT_COLOR_SHADOW,
46 GNT_COLOR_TITLE,
47 GNT_COLOR_TITLE_D,
48 GNT_COLOR_URGENT, /* this is for the 'urgent' windows */
49 GNT_COLORS
50 } GntColorType;
52 enum
54 GNT_COLOR_BLACK = 0,
55 GNT_COLOR_RED,
56 GNT_COLOR_GREEN,
57 GNT_COLOR_BLUE,
58 GNT_COLOR_WHITE,
59 GNT_COLOR_GRAY,
60 GNT_COLOR_DARK_GRAY,
61 GNT_TOTAL_COLORS
64 /**
65 * Initialize the colors.
67 void gnt_init_colors(void);
69 /**
70 * Uninitialize the colors.
72 void gnt_uninit_colors(void);
74 #if GLIB_CHECK_VERSION(2,6,0)
75 /**
76 * Parse color information from a file.
78 * @param kfile The file containing color information.
80 void gnt_colors_parse(GKeyFile *kfile);
82 /**
83 * Parse color-pair information from a file.
85 * @param kfile The file containing the color-pair information.
87 void gnt_color_pairs_parse(GKeyFile *kfile);
89 /**
90 * Parse a string color
92 * @param kfile The string value
94 * @return A color
96 * @since 2.4.0
98 int gnt_colors_get_color(char *key);
99 #endif
102 * Return the appropriate character attribute for a specified color.
103 * If the terminal doesn't have color support, this returns A_STANDOUT
104 * when deemed appropriate.
106 * @param color The color code.
108 * @return A character attribute.
110 * @since 2.3.0
112 int gnt_color_pair(int color);
115 * Adds a color definition
117 * @param fg Foreground
118 * @param bg Background
120 * @return A color pair
122 * @since 2.4.0
124 int gnt_color_add_pair(int fg, int bg);
125 #endif