summaryrefslogtreecommitdiff
path: root/pith/color.h
blob: 31b1cee717200415cf4ea92cddc5ede164953eb1 (plain)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
 * $Id: color.h 768 2007-10-24 00:10:03Z hubert@u.washington.edu $
 *
 * ========================================================================
 * Copyright 2013-2021 Eduardo Chappa
 * Copyright 2006 University of Washington
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * ========================================================================
 */

#ifndef PITH_COLOR_INCLUDED
#define PITH_COLOR_INCLUDED


#include "../pith/filttype.h"
#include "../pith/pattern.h"
#include "../pith/osdep/color.h"


typedef struct spec_color_s {
    int   inherit;	/* this isn't a color, it is INHERIT */
    char *spec;
    char *fg;
    char *bg;
    PATTERN_S *val;
    struct spec_color_s *next;
} SPEC_COLOR_S;


/*
 * These are default colors that you'll get when you turn
 * color on. The way color works is that the closest possible
 * RGB value is chosen so these colors will produce different
 * results in the different color models (the 8-color, 16-color,
 * xterm 256-color, and PC-Alpine color).
 * See init_color_table() for the RGB values we use.
 * The 8-color model uses the 8 0 or 255 possibilities. So,
 * for example, if the default color is "000,217,217" the
 * closes 8-color version of that is going to be "000,255,255".
 * In the 16-color terminal we use 000, 174, and 255 as the
 * possible values. That means that a default value
 * of "000,214,000" maps to "000,174,000" (a dull green)
 * but "000,215,000" maps to "000,255,000" (a bright green).
 *
 * The colors which don't have defaults map to either the current
 * setting of the Normal color or the current setting of the
 * Reverse color, depending on what we thought was right long ago.
 */
#define DEFAULT_TITLE_FORE_RGB		"000,000,000"
#define DEFAULT_TITLE_BACK_RGB		"255,255,000"
#define DEFAULT_TITLECLOSED_FORE_RGB	"255,255,255"
#define DEFAULT_TITLECLOSED_BACK_RGB	"255,000,000"
#define DEFAULT_METAMSG_FORE_RGB	"000,000,000"
#define DEFAULT_METAMSG_BACK_RGB	"255,255,000"
#define DEFAULT_QUOTE1_FORE_RGB		"000,000,000"
#define DEFAULT_QUOTE1_BACK_RGB		"000,217,217"
#define DEFAULT_QUOTE2_FORE_RGB		"000,000,000"
#define DEFAULT_QUOTE2_BACK_RGB		"204,214,000"
#define DEFAULT_QUOTE3_FORE_RGB		"000,000,000"
#define DEFAULT_QUOTE3_BACK_RGB		"000,214,000"
#define DEFAULT_SIGNATURE_FORE_RGB	"000,000,255"
#define DEFAULT_SIGNATURE_BACK_RGB	"255,255,255"
#define DEFAULT_IND_PLUS_FORE_RGB	"000,000,000"
#define DEFAULT_IND_PLUS_BACK_RGB	"000,174,174"
#define DEFAULT_IND_IMP_FORE_RGB	"240,240,240"
#define DEFAULT_IND_IMP_BACK_RGB	"174,000,000"
#define DEFAULT_IND_ANS_FORE_RGB	"255,000,000"
#define DEFAULT_IND_ANS_BACK_RGB	"174,174,000"
#define DEFAULT_IND_NEW_FORE_RGB	"240,240,240"
#define DEFAULT_IND_NEW_BACK_RGB	"174,000,174"
#define DEFAULT_IND_OP_FORE_RGB		"192,192,192"
#define DEFAULT_IND_OP_BACK_RGB		"255,255,255"


/* exported prototypes */
char	*color_embed(char *, char *);
int	 colorcmp(char *, char *);
int	 color_a_quote(long, char *, LT_INS_S **, void *);
void	 free_spec_colors(SPEC_COLOR_S **);


#endif /* PITH_COLOR_INCLUDED */