NeoMutt  2019-12-07-60-g0cfa53
Teaching an old dog new tricks
Go to the documentation of this file.
23 #ifndef MUTT_COLOR_H
24 #define MUTT_COLOR_H
26 #include "config.h"
27 #include <regex.h>
28 #include <stdbool.h>
29 #include <stdint.h>
30 #include "mutt/mutt.h"
31 #include "mutt_commands.h"
36 struct ColorLine
37 {
38  regex_t regex;
39  int match;
40  char *pattern;
41  struct PatternList *color_pattern;
42  uint32_t fg;
43  uint32_t bg;
44  int pair;
46  bool stop_matching : 1;
48  STAILQ_ENTRY(ColorLine) entries;
49 };
50 STAILQ_HEAD(ColorLineList, ColorLine);
59 enum ColorId
60 {
84 #ifdef USE_SIDEBAR
93 #endif
100  /* please no non-MT_COLOR_INDEX objects after this point */
106  /* below here - only index coloring stuff that doesn't have a pattern */
114 };
119 struct ColorList
120 {
121  /* TrueColor uses 24bit. Use fixed-width integer type to make sure it fits.
122  * Use the upper 8 bits to store flags. */
123  uint32_t fg;
124  uint32_t bg;
125  short index;
126  short count;
127  struct ColorList *next;
128 };
130 struct Colors
131 {
132  int *defs;
134  struct ColorLineList attach_list;
135  struct ColorLineList body_list;
136  struct ColorLineList hdr_list;
137  struct ColorLineList index_author_list;
138  struct ColorLineList index_flags_list;
139  struct ColorLineList index_list;
140  struct ColorLineList index_subject_list;
141  struct ColorLineList index_tag_list;
142  struct ColorLineList status_list;
144  int *quotes;
150  struct Notify *notify;
151 };
160 {
161  bool set;
162 };
164 int mutt_color_alloc (struct Colors *c, uint32_t fg, uint32_t bg);
165 int mutt_color_combine(struct Colors *c, uint32_t fg_attr, uint32_t bg_attr);
166 void mutt_color_free (struct Colors *c, uint32_t fg, uint32_t bg);
168 struct Colors *mutt_colors_new(void);
169 void mutt_colors_free(struct Colors **ptr);
171 enum CommandResult mutt_parse_color (struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
172 enum CommandResult mutt_parse_mono (struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
173 enum CommandResult mutt_parse_uncolor(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
174 enum CommandResult mutt_parse_unmono (struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
176 #endif /* MUTT_COLOR_H */
Mail will be encrypted.
Definition: color.h:68
MIME attachment test (takes a pattern)
Definition: color.h:63
Bold text.
Definition: color.h:65
Index: index number.
Definition: color.h:110
Header default colour.
Definition: color.h:72
Underlined text.
Definition: color.h:98
Progress bar.
Definition: color.h:80
enum CommandResult mutt_parse_mono(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err)
Parse the &#39;mono&#39; command - Implements command_t.
Definition: color.c:1370
Index: tags field (g, J)
Definition: color.h:112
struct Colors * mutt_colors_new(void)
Create new colours.
Definition: color.c:373
Error codes for command_t parse functions.
Definition: mutt_commands.h:33
struct Notify * notify
Notifications system.
Definition: color.h:150
Informational message.
Definition: color.h:76
An Event that happened to an Colour.
Definition: color.h:159
STAILQ_HEAD(ColorLineList, ColorLine)
Pager: highlight body of message (takes a pattern)
Definition: color.h:64
void mutt_colors_free(struct Colors **ptr)
Free all the colours.
Definition: color.c:355
Mailbox with no new or flagged messages.
Definition: color.h:90
int * defs
Array of all fixed colours, see enum ColorId.
Definition: color.h:132
struct PatternList * color_pattern
Compiled pattern to speed up index color calculation.
Definition: color.h:41
char * pattern
Pattern to match.
Definition: color.h:40
int pair
Colour pair index.
Definition: color.h:44
String manipulation buffer.
Definition: buffer.h:33
Line dividing sidebar from the index/pager.
Definition: color.h:85
Pager: signature lines.
Definition: color.h:94
Select cursor.
Definition: color.h:87
Pager: quoted text.
Definition: color.h:82
Index: number of messages in collapsed thread.
Definition: color.h:107
int num_user_colors
Definition: color.h:148
short count
Definition: color.h:126
Mailbox with new mail.
Definition: color.h:89
Current open mailbox.
Definition: color.h:88
Menu showing log messages.
Definition: color.h:77
void mutt_color_free(struct Colors *c, uint32_t fg, uint32_t bg)
Free a colour.
Definition: color.c:251
int match
Substring to match, 0 for old behaviour.
Definition: color.h:39
int mutt_color_alloc(struct Colors *c, uint32_t fg, uint32_t bg)
Index: author field (takes a pattern)
Definition: color.h:102
short index
Definition: color.h:125
Pager: empty lines after message.
Definition: color.h:96
Message headers (takes a pattern)
Definition: color.h:73
Index: tag field (g, takes a pattern)
Definition: color.h:105
List of all colored objects.
Definition: color.h:59
uint32_t bg
Definition: color.h:124
Index: tree-drawing characters.
Definition: color.h:97
Pager: markers, line continuation.
Definition: color.h:75
Plain text.
Definition: color.h:78
uint32_t fg
Foreground colour.
Definition: color.h:42
Index: date field.
Definition: color.h:108
struct ColorList * next
Definition: color.h:127
bool stop_matching
Used by the pager for body patterns, to prevent the color from being retried once it fails...
Definition: color.h:46
Index: size field.
Definition: color.h:111
Status bar (takes a pattern)
Definition: color.h:95
uint32_t bg
Background colour.
Definition: color.h:43
Header labels, e.g. From:
Definition: color.h:66
struct ColorList * user_colors
Definition: color.h:147
uint32_t fg
Definition: color.h:123
Selected item in list.
Definition: color.h:74
Mapping from user command name to function.
Mail will be signed.
Definition: color.h:70
int mutt_color_combine(struct Colors *c, uint32_t fg_attr, uint32_t bg_attr)
Notification API.
Definition: notify.c:40
Definition: color.h:130
enum CommandResult mutt_parse_unmono(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err)
Parse the &#39;unmono&#39; command - Implements command_t.
Definition: color.c:932
regex_t regex
Compiled regex.
Definition: color.h:38
Mail will be encrypted and signed.
Definition: color.h:67
Index: label field.
Definition: color.h:109
enum CommandResult mutt_parse_color(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err)
Index: subject field (takes a pattern)
Definition: color.h:104
Error message.
Definition: color.h:71
MIME attachments text (entire line)
Definition: color.h:62
A set of colors.
Definition: color.h:119
Mailbox with unread mail.
Definition: color.h:92
Pager: search matches.
Definition: color.h:83
Mail will not be encrypted or signed.
Definition: color.h:69
Options in prompt.
Definition: color.h:79
Index: default colour (takes a pattern)
Definition: color.h:101
int quotes_used
Number of colours for quoted email text.
Definition: color.h:145
enum CommandResult mutt_parse_uncolor(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err)
Question/user input.
Definition: color.h:81
Mailbox with flagged messages.
Definition: color.h:86
Warning messages.
Definition: color.h:99
Index: flags field (takes a pattern)
Definition: color.h:103
A regular expression and a color to highlight a line.
Definition: color.h:36
$spoolfile (Spool mailbox)
Definition: color.h:91
STAILQ_ENTRY(ColorLine) entries
Linked list.
int * quotes
Array of colours for quoted email text.
Definition: color.h:144