-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolor.c
72 lines (63 loc) · 1.64 KB
/
color.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* color.c
*
* CAVE WALL - Colored Ascii Visual Editor Without Any Loathsome Limitations
* Color management routines
*
* Copyright (C) 2002 Michal Miszewski <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <curses.h>
#include "color.h"
#include "status.h"
#include "config.h"
/* default text attributes */
short color, background;
chtype attribute;
short pair; /* actual color pair */
int avals[] = {A_NORMAL, A_UNDERLINE, A_REVERSE, A_BLINK, A_DIM, A_BOLD};
extern struct config
{
int defcolor, defbgnd, defattr, defmode, fromzero,
key_up, key_down, key_left, key_right,
key_leftborder, key_rightborder, key_upborder, key_downborder,
key_delch, key_backspc, key_addattribs,
key_export, key_import, key_color, key_bgnd, key_attrib, key_mode, key_clear, key_block, key_paste, key_undo, key_menu, key_unknown;
} conf;
/* color-pairs generation */
void init_pairs(void)
{
short a, b;
short c = 0;
for (a = 0; a < 8; a++)
{
for (b = 0; b < 8; b++)
{
c++;
init_pair(c, a, b);
}
}
/* color pairs suck */
}
/* finds pair number for selected colour and background */
short find_pair(short col, short bgnd)
{
int a;
short pcol, pbgnd;
for (a = 1; a < 64; a++)
{
pair_content(a, &pcol, &pbgnd);
if ((pcol == col) && (pbgnd == bgnd)) break;
}
return a;
}
/* gets the start-up values from the conf structure */
void color_load_defaults(void)
{
color = conf.defcolor;
background = conf.defbgnd;
attribute = 0 | conf.defattr;
}