Mercurial > pidgin
comparison console/libgnt/gntcolors.c @ 13964:0a0d2a1fd2bc
[gaim-migrate @ 16520]
Add multi-column support for GntTree. Use it for email-notifications.
Restore colors before exiting.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 19 Jul 2006 07:12:59 +0000 |
parents | b210409cdc56 |
children | 06f75fb84a78 |
comparison
equal
deleted
inserted
replaced
13963:f7cfaee79982 | 13964:0a0d2a1fd2bc |
---|---|
1 #include <ncursesw/ncurses.h> | 1 #include <ncursesw/ncurses.h> |
2 #include "gntcolors.h" | 2 #include "gntcolors.h" |
3 | 3 |
4 static struct | |
5 { | |
6 short r, g, b; | |
7 } colors[GNT_TOTAL_COLORS]; | |
8 | |
9 static void | |
10 backup_colors() | |
11 { | |
12 short i; | |
13 for (i = 0; i < GNT_TOTAL_COLORS; i++) | |
14 { | |
15 color_content(i, &colors[i].r, | |
16 &colors[i].g, &colors[i].b); | |
17 } | |
18 } | |
19 | |
20 static void | |
21 restore_colors() | |
22 { | |
23 short i; | |
24 for (i = 0; i < GNT_TOTAL_COLORS; i++) | |
25 { | |
26 init_color(i, colors[i].r, | |
27 colors[i].g, colors[i].b); | |
28 } | |
29 } | |
30 | |
4 void gnt_init_colors() | 31 void gnt_init_colors() |
5 { | 32 { |
33 start_color(); | |
6 if (can_change_color()) | 34 if (can_change_color()) |
7 { | 35 { |
36 backup_colors(); | |
37 | |
8 /* XXX: Do some init_color()s */ | 38 /* XXX: Do some init_color()s */ |
9 init_color(GNT_COLOR_BLACK, 0, 0, 0); | 39 init_color(GNT_COLOR_BLACK, 0, 0, 0); |
10 init_color(GNT_COLOR_RED, 1000, 0, 0); | 40 init_color(GNT_COLOR_RED, 1000, 0, 0); |
11 init_color(GNT_COLOR_GREEN, 0, 1000, 0); | 41 init_color(GNT_COLOR_GREEN, 0, 1000, 0); |
12 init_color(GNT_COLOR_BLUE, 250, 250, 700); | 42 init_color(GNT_COLOR_BLUE, 250, 250, 700); |
37 init_pair(GNT_COLOR_HIGHLIGHT_D, COLOR_CYAN, COLOR_BLACK); | 67 init_pair(GNT_COLOR_HIGHLIGHT_D, COLOR_CYAN, COLOR_BLACK); |
38 init_pair(GNT_COLOR_DISABLED, COLOR_YELLOW, COLOR_WHITE); | 68 init_pair(GNT_COLOR_DISABLED, COLOR_YELLOW, COLOR_WHITE); |
39 } | 69 } |
40 } | 70 } |
41 | 71 |
72 void | |
73 gnt_uninit_colors() | |
74 { | |
75 restore_colors(); | |
76 } | |
77 |