NeoMutt  2021-02-05-666-ge300cd
Teaching an old dog new tricks
DOXYGEN
color.h
Go to the documentation of this file.
1 
23 #ifndef MUTT_COLOR_H
24 #define MUTT_COLOR_H
25 
26 #include "config.h"
27 #include <stdbool.h>
28 #include <stdint.h>
29 #include "mutt/lib.h"
30 #include "mutt_commands.h"
31 
39 enum ColorId
40 {
64 #ifdef USE_SIDEBAR
73 #endif
80  /* please no non-MT_COLOR_INDEX objects after this point */
86  /* below here - only index coloring stuff that doesn't have a pattern */
94 };
95 
99 struct ColorLine
100 {
101  regex_t regex;
102  int match;
103  char *pattern;
104  struct PatternList *color_pattern;
105  uint32_t fg;
106  uint32_t bg;
107  int pair;
108 
109  bool stop_matching : 1;
110 
111  STAILQ_ENTRY(ColorLine) entries;
112 };
113 STAILQ_HEAD(ColorLineList, ColorLine);
114 
123 {
124  enum ColorId color;
125 };
126 
135 {
138 };
139 
140 bool mutt_color_is_header(enum ColorId color_id);
141 int mutt_color_alloc (uint32_t fg, uint32_t bg);
142 int mutt_color_combine(uint32_t fg_attr, uint32_t bg_attr);
143 void mutt_color_free (uint32_t fg, uint32_t bg);
144 
145 void mutt_colors_init(void);
146 void mutt_colors_cleanup(void);
147 
148 enum CommandResult mutt_parse_color (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
149 enum CommandResult mutt_parse_mono (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
150 enum CommandResult mutt_parse_uncolor(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
151 enum CommandResult mutt_parse_unmono (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
152 
153 int mutt_color(enum ColorId id);
154 struct ColorLineList *mutt_color_status_line(void);
155 struct ColorLineList *mutt_color_index(void);
156 struct ColorLineList *mutt_color_headers(void);
157 struct ColorLineList *mutt_color_body(void);
158 struct ColorLineList *mutt_color_attachments(void);
159 struct ColorLineList *mutt_color_index_author(void);
160 struct ColorLineList *mutt_color_index_flags(void);
161 struct ColorLineList *mutt_color_index_subject(void);
162 struct ColorLineList *mutt_color_index_tags(void);
163 int mutt_color_quote(int quote);
164 int mutt_color_quotes_used(void);
165 
166 void mutt_color_observer_add(observer_t callback, void *global_data);
168 
169 #endif /* MUTT_COLOR_H */
Mail will be encrypted.
Definition: color.h:48
MIME attachment test (takes a pattern)
Definition: color.h:43
Bold text.
Definition: color.h:45
Index: index number.
Definition: color.h:90
Header default colour.
Definition: color.h:52
Underlined text.
Definition: color.h:78
Progress bar.
Definition: color.h:60
Index: tags field (g, J)
Definition: color.h:92
CommandResult
Error codes for command_t parse functions.
Definition: mutt_commands.h:34
Informational message.
Definition: color.h:56
An Event that happened to a Colour.
Definition: color.h:122
STAILQ_HEAD(ColorLineList, ColorLine)
void mutt_color_observer_remove(observer_t callback, void *global_data)
Remove an observer.
Definition: color.c:1550
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:955
Pager: highlight body of message (takes a pattern)
Definition: color.h:44
Mailbox with no new or flagged messages.
Definition: color.h:70
struct PatternList * color_pattern
Compiled pattern to speed up index color calculation.
Definition: color.h:104
char * pattern
Pattern to match.
Definition: color.h:103
int pair
Colour pair index.
Definition: color.h:107
String manipulation buffer.
Definition: buffer.h:33
Line dividing sidebar from the index/pager.
Definition: color.h:65
Pager: signature lines.
Definition: color.h:74
Select cursor.
Definition: color.h:67
struct ColorLineList * mutt_color_attachments(void)
Return the ColorLineList for the attachments.
Definition: color.c:1472
void mutt_colors_init(void)
Initialize colours.
Definition: color.c:393
void mutt_colors_cleanup(void)
Cleanup all the colours.
Definition: color.c:384
Pager: quoted text.
Definition: color.h:62
struct ColorLineList * mutt_color_index_author(void)
Return the ColorLineList for author in the index.
Definition: color.c:1481
void mutt_color_free(uint32_t fg, uint32_t bg)
Free a colour.
Definition: color.c:284
int mutt_color_alloc(uint32_t fg, uint32_t bg)
Allocate a colour pair.
Definition: color.c:478
int mutt_color_combine(uint32_t fg_attr, uint32_t bg_attr)
Combine two colours.
Definition: color.c:581
Index: number of messages in collapsed thread.
Definition: color.h:87
Mailbox with new mail.
Definition: color.h:69
struct ColorLineList * mutt_color_headers(void)
Return the ColorLineList for headers.
Definition: color.c:1454
Current open mailbox.
Definition: color.h:68
Menu showing log messages.
Definition: color.h:57
int match
Substring to match, 0 for old behaviour.
Definition: color.h:102
Index: author field (takes a pattern)
Definition: color.h:82
void mutt_color_observer_add(observer_t callback, void *global_data)
Add an observer.
Definition: color.c:1540
Pager: empty lines after message.
Definition: color.h:76
int(* observer_t)(struct NotifyCallback *nc)
Prototype for a notification callback function.
Definition: observer.h:58
Message headers (takes a pattern)
Definition: color.h:53
Index: tag field (g, takes a pattern)
Definition: color.h:85
ColorId
List of all colored objects.
Definition: color.h:39
Index: tree-drawing characters.
Definition: color.h:77
Pager: markers, line continuation.
Definition: color.h:55
int mutt_color(enum ColorId id)
Return the color of an object.
Definition: color.c:1427
Plain text.
Definition: color.h:58
Color has been set.
Definition: color.h:136
uint32_t fg
Foreground colour.
Definition: color.h:105
Index: date field.
Definition: color.h:88
bool mutt_color_is_header(enum ColorId color_id)
Colour is for an Email header.
Definition: color.c:1560
bool stop_matching
Used by the pager for body patterns, to prevent the color from being retried once it fails...
Definition: color.h:109
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:1391
Index: size field.
Definition: color.h:91
Status bar (takes a pattern)
Definition: color.h:75
uint32_t bg
Background colour.
Definition: color.h:106
Header labels, e.g. From:
Definition: color.h:46
struct ColorLineList * mutt_color_index_flags(void)
Return the ColorLineList for flags in the index.
Definition: color.c:1490
NotifyColor
Types of Color Event.
Definition: color.h:134
struct ColorLineList * mutt_color_index(void)
Return the ColorLineList for the index.
Definition: color.c:1445
Color has been reset/removed.
Definition: color.h:137
Selected item in list.
Definition: color.h:54
Definitions of NeoMutt commands.
Mail will be signed.
Definition: color.h:50
static void * global_data
Original opaque data in fallback implementation.
Definition: qsort_r.c:41
regex_t regex
Compiled regex.
Definition: color.h:101
Mail will be encrypted and signed.
Definition: color.h:47
Index: label field.
Definition: color.h:89
Index: subject field (takes a pattern)
Definition: color.h:84
Error message.
Definition: color.h:51
int mutt_color_quote(int quote)
Return the color of a quote, cycling through the used quotes.
Definition: color.c:1518
MIME attachments text (entire line)
Definition: color.h:42
struct ColorLineList * mutt_color_index_tags(void)
Return the ColorLineList for tags in the index.
Definition: color.c:1508
Mailbox with unread mail.
Definition: color.h:72
Pager: search matches.
Definition: color.h:63
Mail will not be encrypted or signed.
Definition: color.h:49
Options in prompt.
Definition: color.h:59
Index: default colour (takes a pattern)
Definition: color.h:81
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:970
Convenience wrapper for the library headers.
struct ColorLineList * mutt_color_body(void)
Return the ColorLineList for the body.
Definition: color.c:1463
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:1406
struct ColorLineList * mutt_color_index_subject(void)
Return the ColorLineList for subject in the index.
Definition: color.c:1499
Question/user input.
Definition: color.h:61
Mailbox with flagged messages.
Definition: color.h:66
Warning messages.
Definition: color.h:79
Index: flags field (takes a pattern)
Definition: color.h:83
A regular expression and a color to highlight a line.
Definition: color.h:99
$spool_file (Spool mailbox)
Definition: color.h:71
STAILQ_ENTRY(ColorLine) entries
Linked list.
int mutt_color_quotes_used(void)
Return the number of used quotes.
Definition: color.c:1530
struct ColorLineList * mutt_color_status_line(void)
Return the ColorLineList for the status_line.
Definition: color.c:1436