File: color.c

package info (click to toggle)
ytree 1.64-4.1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 532 kB
  • ctags: 766
  • sloc: ansic: 10,758; makefile: 116
file content (70 lines) | stat: -rw-r--r-- 1,881 bytes parent folder | download | duplicates (2)
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
/***************************************************************************
 *
 * $Header: /home/werner/ytree/RCS/color.c,v 1.2 1997/08/13 12:24:58 werner Rel $
 *
 * Dynamic Colors-Support
 *
 ***************************************************************************/


#include "ytree.h"


#ifdef COLOR_SUPPORT

static BOOL color_enabled = FALSE;


void StartColors()
{
  start_color();
  if ((COLORS < 8) || (COLOR_PAIRS < 17)) {
    ESCAPE; /* no color support */
  }

  init_pair(DIR_COLOR,     COLOR_WHITE,   COLOR_BLUE);
  init_pair(HIDIR_COLOR,   COLOR_BLACK,   COLOR_WHITE);
  init_pair(WINDIR_COLOR,  COLOR_CYAN,    COLOR_BLUE);
  init_pair(FILE_COLOR,    COLOR_WHITE,   COLOR_BLUE);
  init_pair(HIFILE_COLOR,  COLOR_BLACK,   COLOR_WHITE);
  init_pair(WINFILE_COLOR, COLOR_CYAN,    COLOR_BLUE);
  init_pair(STATS_COLOR,   COLOR_BLUE,    COLOR_CYAN);
  init_pair(WINSTATS_COLOR,COLOR_BLUE,    COLOR_CYAN);
  init_pair(BORDERS_COLOR, COLOR_BLUE,    COLOR_CYAN);
  init_pair(HIMENUS_COLOR, COLOR_WHITE,   COLOR_BLUE);
  init_pair(MENU_COLOR,    COLOR_CYAN,    COLOR_BLUE);
  init_pair(WINERR_COLOR,  COLOR_BLUE,    COLOR_WHITE);
  init_pair(HST_COLOR,     COLOR_YELLOW,  COLOR_CYAN);
  init_pair(HIHST_COLOR,   COLOR_WHITE,   COLOR_WHITE);
  init_pair(WINHST_COLOR,  COLOR_YELLOW,  COLOR_CYAN);
  init_pair(HIGLOBAL_COLOR,COLOR_BLUE,    COLOR_WHITE);
  init_pair(GLOBAL_COLOR,  COLOR_YELLOW,  COLOR_CYAN);

  color_enabled = TRUE;
FNC_XIT: ;

}



void WbkgdSet(WINDOW *w, chtype c)
{
  if(color_enabled) {
    wbkgdset(w, c);
  } else {
    c &= ~A_BOLD;
    if(c == COLOR_PAIR(HIDIR_COLOR)   ||
       c == COLOR_PAIR(HIFILE_COLOR)  ||
       c == COLOR_PAIR(HISTATS_COLOR) ||
       c == COLOR_PAIR(HIMENUS_COLOR) ||
       c == COLOR_PAIR(HIHST_COLOR)) {
    
      wattrset(w, A_REVERSE);
    } else {
      wattrset(w, 0);
    }
  }
}


#endif /* COLOR_SUPPORT */