NeoMutt  2020-09-25
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 <stdbool.h>
28 #include <stdint.h>
29 #include "mutt/lib.h"
30 #include "mutt_commands.h"
35 struct ColorLine
36 {
37  regex_t regex;
38  int match;
39  char *pattern;
40  struct PatternList *color_pattern;
41  uint32_t fg;
42  uint32_t bg;
43  int pair;
45  bool stop_matching : 1;
47  STAILQ_ENTRY(ColorLine) entries;
48 };
49 STAILQ_HEAD(ColorLineList, ColorLine);
58 enum ColorId
59 {
83 #ifdef USE_SIDEBAR
92 #endif
99  /* please no non-MT_COLOR_INDEX objects after this point */
105  /* below here - only index coloring stuff that doesn't have a pattern */
113 };
118 struct ColorList
119 {
120  /* TrueColor uses 24bit. Use fixed-width integer type to make sure it fits.
121  * Use the upper 8 bits to store flags. */
122  uint32_t fg;
123  uint32_t bg;
124  short index;
125  short count;
126  struct ColorList *next;
127 };
129 struct Colors
130 {
131  int *defs;
133  struct ColorLineList attach_list;
134  struct ColorLineList body_list;
135  struct ColorLineList hdr_list;
136  struct ColorLineList index_author_list;
137  struct ColorLineList index_flags_list;
138  struct ColorLineList index_list;
139  struct ColorLineList index_subject_list;
140  struct ColorLineList index_tag_list;
141  struct ColorLineList status_list;
143  int *quotes;
149  struct Notify *notify;
150 };
160 {
161  enum ColorId color;
162 };
170 {
173 };
175 int mutt_color_alloc (struct Colors *c, uint32_t fg, uint32_t bg);
176 int mutt_color_combine(struct Colors *c, uint32_t fg_attr, uint32_t bg_attr);
177 void mutt_color_free (struct Colors *c, uint32_t fg, uint32_t bg);
179 struct Colors *mutt_colors_new(void);
180 void mutt_colors_free(struct Colors **ptr);
182 enum CommandResult mutt_parse_color (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
183 enum CommandResult mutt_parse_mono (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
184 enum CommandResult mutt_parse_uncolor(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
185 enum CommandResult mutt_parse_unmono (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
187 #endif /* MUTT_COLOR_H */
Mail will be encrypted.
Definition: color.h:67
MIME attachment test (takes a pattern)
Definition: color.h:62
Bold text.
Definition: color.h:64
Index: index number.
Definition: color.h:109
Header default colour.
Definition: color.h:71
Underlined text.
Definition: color.h:97
Progress bar.
Definition: color.h:79
Index: tags field (g, J)
Definition: color.h:111
struct Colors * mutt_colors_new(void)
Create new colours.
Definition: color.c:373
Error codes for command_t parse functions.
Definition: mutt_commands.h:34
struct Notify * notify
Notifications system.
Definition: color.h:149
Informational message.
Definition: color.h:75
An Event that happened to a Colour.
Definition: color.h:159
STAILQ_HEAD(ColorLineList, ColorLine)
enum CommandResult mutt_parse_unmono(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;unmono&#39; command - Implements Command::parse()
Definition: color.c:930
Pager: highlight body of message (takes a pattern)
Definition: color.h:63
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:89
int * defs
Array of all fixed colours, see enum ColorId.
Definition: color.h:131
struct PatternList * color_pattern
Compiled pattern to speed up index color calculation.
Definition: color.h:40
char * pattern
Pattern to match.
Definition: color.h:39
int pair
Colour pair index.
Definition: color.h:43
String manipulation buffer.
Definition: buffer.h:33
Line dividing sidebar from the index/pager.
Definition: color.h:84
Pager: signature lines.
Definition: color.h:93
Select cursor.
Definition: color.h:86
Pager: quoted text.
Definition: color.h:81
Index: number of messages in collapsed thread.
Definition: color.h:106
int num_user_colors
Definition: color.h:147
short count
Definition: color.h:125
Mailbox with new mail.
Definition: color.h:88
Current open mailbox.
Definition: color.h:87
Menu showing log messages.
Definition: color.h:76
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:38
int mutt_color_alloc(struct Colors *c, uint32_t fg, uint32_t bg)
Allocate a colour pair.
Definition: color.c:471
Index: author field (takes a pattern)
Definition: color.h:101
short index
Definition: color.h:124
Pager: empty lines after message.
Definition: color.h:95
Message headers (takes a pattern)
Definition: color.h:72
Index: tag field (g, takes a pattern)
Definition: color.h:104
List of all colored objects.
Definition: color.h:58
uint32_t bg
Definition: color.h:123
enum CommandResult mutt_parse_uncolor(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;uncolor&#39; command - Implements Command::parse()
Definition: color.c:920
Index: tree-drawing characters.
Definition: color.h:96
Pager: markers, line continuation.
Definition: color.h:74
Plain text.
Definition: color.h:77
A new Color has been set.
Definition: color.h:171
uint32_t fg
Foreground colour.
Definition: color.h:41
Index: date field.
Definition: color.h:107
struct ColorList * next
Definition: color.h:126
bool stop_matching
Used by the pager for body patterns, to prevent the color from being retried once it fails...
Definition: color.h:45
Index: size field.
Definition: color.h:110
Status bar (takes a pattern)
Definition: color.h:94
uint32_t bg
Background colour.
Definition: color.h:42
Header labels, e.g. From:
Definition: color.h:65
Types of Color Event.
Definition: color.h:169
struct ColorList * user_colors
Definition: color.h:146
Color has been reset/removed.
Definition: color.h:172
uint32_t fg
Definition: color.h:122
Selected item in list.
Definition: color.h:73
Definitions of NeoMutt commands.
Mail will be signed.
Definition: color.h:69
enum CommandResult mutt_parse_mono(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;mono&#39; command - Implements Command::parse()
Definition: color.c:1360
int mutt_color_combine(struct Colors *c, uint32_t fg_attr, uint32_t bg_attr)
Combine two colours.
Definition: color.c:576
Notification API.
Definition: notify.c:39
Definition: color.h:129
regex_t regex
Compiled regex.
Definition: color.h:37
Mail will be encrypted and signed.
Definition: color.h:66
Index: label field.
Definition: color.h:108
Index: subject field (takes a pattern)
Definition: color.h:103
Error message.
Definition: color.h:70
MIME attachments text (entire line)
Definition: color.h:61
A set of colors.
Definition: color.h:118
Mailbox with unread mail.
Definition: color.h:91
Pager: search matches.
Definition: color.h:82
Mail will not be encrypted or signed.
Definition: color.h:68
Options in prompt.
Definition: color.h:78
Index: default colour (takes a pattern)
Definition: color.h:100
Convenience wrapper for the library headers.
int quotes_used
Number of colours for quoted email text.
Definition: color.h:144
enum CommandResult mutt_parse_color(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the &#39;color&#39; command - Implements Command::parse()
Definition: color.c:1345
Question/user input.
Definition: color.h:80
Mailbox with flagged messages.
Definition: color.h:85
Warning messages.
Definition: color.h:98
Index: flags field (takes a pattern)
Definition: color.h:102
A regular expression and a color to highlight a line.
Definition: color.h:35
$spoolfile (Spool mailbox)
Definition: color.h:90
STAILQ_ENTRY(ColorLine) entries
Linked list.
int * quotes
Array of colours for quoted email text.
Definition: color.h:143