129 bool is_fg,
struct Buffer *err)
132 bool is_alert =
false, is_bright =
false, is_light =
false;
159 *col = strtoul(s, &eptr, 10);
160 if ((*s ==
'\0') || (*eptr !=
'\0') || ((*col >= COLORS) && !
OptNoCurses))
176 if (is_bright || is_light)
185 if ((COLORS >= 16) && is_light)
218 uint32_t *fg, uint32_t *bg,
219 int *attrs,
struct Buffer *err)
245 *attrs |= A_STANDOUT;
247 *attrs |= A_UNDERLINE;
263 uint32_t *fg, uint32_t *bg,
264 int *attrs,
struct Buffer *err)
303 *attrs |= A_STANDOUT;
308 *attrs |= A_UNDERLINE;
338 const char *
name = NULL;
376 if (buf->
data[6] !=
'\0')
439 struct Buffer *err,
bool uncolor)
494 bool changes =
false;
524#ifdef USE_DEBUG_COLOR
529 intptr_t data,
struct Buffer *err)
537 char color_fg[32] = { 0 };
538 char color_bg[32] = { 0 };
645#ifdef USE_DEBUG_COLOR
690 fputs(filebuf.
data, fp_out);
725 bool dry_run,
bool color)
727 int attrs = 0, q_level = 0;
728 uint32_t fg = 0, bg = 0, match = 0;
734#ifdef USE_DEBUG_COLOR
736 return color_dump(buf, s, 0, err);
750 rc = callback(buf, s, &fg, &bg, &attrs, err);
787 (use_default_colors() != OK))
818 if (!mutt_str_atoui_full(tmp.
data, &match))
821 color ?
"color" :
"mono", tmp.
data);
861 intptr_t data,
struct Buffer *err)
879 intptr_t data,
struct Buffer *err)
889 intptr_t data,
struct Buffer *err)
904 intptr_t data,
struct Buffer *err)
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
size_t mutt_buffer_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
int mutt_buffer_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
const struct Mapping ComposeColorFields[]
Mapping of compose colour names to their IDs.
void get_colorid_name(unsigned int cid, struct Buffer *buf)
Get the name of a color id.
const struct Mapping ColorFields[]
Mapping of colour names to their IDs.
static enum CommandResult parse_color(struct Buffer *buf, struct Buffer *s, struct Buffer *err, parser_callback_t callback, bool dry_run, bool color)
Parse a 'color' command.
static enum CommandResult parse_color_name(const char *s, uint32_t *col, int *attrs, bool is_fg, struct Buffer *err)
Parse a colour name.
static enum CommandResult parse_object(struct Buffer *buf, struct Buffer *s, enum ColorId *cid, int *ql, struct Buffer *err)
Identify a colour object.
static enum CommandResult parse_uncolor(struct Buffer *buf, struct Buffer *s, struct Buffer *err, bool uncolor)
Parse an 'uncolor' command.
struct Notify * ColorsNotify
Notifications: ColorId, EventColor.
struct RegexColorList * regex_colors_get_list(enum ColorId cid)
Return the RegexColorList for a colour id.
bool regex_colors_parse_uncolor(enum ColorId cid, const char *pat, bool uncolor)
Parse a Regex 'uncolor' command.
bool regex_colors_parse_color_list(enum ColorId cid, const char *pat, uint32_t fg, uint32_t bg, int attrs, int *rc, struct Buffer *err)
Parse a Regex 'color' command.
int regex_colors_parse_status_list(enum ColorId cid, const char *pat, uint32_t fg, uint32_t bg, int attrs, int match, struct Buffer *err)
Parse a Regex 'color status' command.
struct AttrColor * simple_color_set(enum ColorId cid, int fg, int bg, int attrs)
Set the colour of a simple object.
void simple_color_reset(enum ColorId cid)
Clear the colour of a simple object.
struct AttrColor * simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
const struct Mapping ColorNames[]
bool mutt_color_has_pattern(enum ColorId cid)
Check if a color object supports a regex pattern.
void colors_clear(void)
Reset all the simple, quoted and regex colours.
ColorId
List of all colored objects.
@ MT_COLOR_SIDEBAR_DIVIDER
Line dividing sidebar from the index/pager.
@ MT_COLOR_MARKERS
Pager: markers, line continuation.
@ MT_COLOR_COMPOSE_SECURITY_ENCRYPT
Mail will be encrypted.
@ MT_COLOR_MESSAGE
Informational message.
@ MT_COLOR_QUOTED
Pager: quoted text.
@ MT_COLOR_INDEX_AUTHOR
Index: author field.
@ MT_COLOR_SIDEBAR_NEW
Mailbox with new mail.
@ MT_COLOR_HEADER
Message headers (takes a pattern)
@ MT_COLOR_STATUS
Status bar (takes a pattern)
@ MT_COLOR_SIDEBAR_UNREAD
Mailbox with unread mail.
@ MT_COLOR_INDEX_SIZE
Index: size field.
@ MT_COLOR_INDICATOR
Selected item in list.
@ MT_COLOR_SIDEBAR_SPOOLFILE
$spool_file (Spool mailbox)
@ MT_COLOR_ERROR
Error message.
@ MT_COLOR_COMPOSE_SECURITY_NONE
Mail will not be encrypted or signed.
@ MT_COLOR_SIDEBAR_ORDINARY
Mailbox with no new or flagged messages.
@ MT_COLOR_INDEX_TAGS
Index: tags field (g, J)
@ MT_COLOR_BOLD
Bold text.
@ MT_COLOR_INDEX_SUBJECT
Index: subject field.
@ MT_COLOR_BODY
Pager: highlight body of message (takes a pattern)
@ MT_COLOR_INDEX_DATE
Index: date field.
@ MT_COLOR_PROGRESS
Progress bar.
@ MT_COLOR_COMPOSE_SECURITY_BOTH
Mail will be encrypted and signed.
@ MT_COLOR_SIDEBAR_BACKGROUND
Background colour for the Sidebar.
@ MT_COLOR_INDEX_TAG
Index: tag field (G)
@ MT_COLOR_HDRDEFAULT
Header default colour.
@ MT_COLOR_OPTIONS
Options in prompt.
@ MT_COLOR_TREE
Index: tree-drawing characters.
@ MT_COLOR_NORMAL
Plain text.
@ MT_COLOR_ATTACH_HEADERS
MIME attachment test (takes a pattern)
@ MT_COLOR_SEARCH
Pager: search matches.
@ MT_COLOR_COMPOSE_SECURITY_SIGN
Mail will be signed.
@ MT_COLOR_INDEX_LABEL
Index: label field.
@ MT_COLOR_ITALIC
Italic text.
@ MT_COLOR_PROMPT
Question/user input.
@ MT_COLOR_COMPOSE_HEADER
Header labels, e.g. From:
@ MT_COLOR_INDEX
Index: default colour.
@ MT_COLOR_ATTACHMENT
MIME attachments text (entire line)
@ MT_COLOR_SIDEBAR_INDICATOR
Current open mailbox.
@ MT_COLOR_SIDEBAR_HIGHLIGHT
Select cursor.
@ MT_COLOR_WARNING
Warning messages.
@ MT_COLOR_UNDERLINE
Underlined text.
@ MT_COLOR_INDEX_NUMBER
Index: index number.
@ MT_COLOR_SIGNATURE
Pager: signature lines.
@ MT_COLOR_INDEX_FLAGS
Index: flags field.
@ MT_COLOR_SIDEBAR_FLAGGED
Mailbox with flagged messages.
@ MT_COLOR_TILDE
Pager: empty lines after message.
@ MT_COLOR_INDEX_COLLAPSED
Index: number of messages in collapsed thread.
int(* parser_callback_t)(struct Buffer *buf, struct Buffer *s, uint32_t *fg, uint32_t *bg, int *attrs, struct Buffer *err)
CommandResult
Error codes for command_t parse functions.
@ MUTT_CMD_SUCCESS
Success: Command worked.
@ MUTT_CMD_ERROR
Error: Can't help the user.
@ MUTT_CMD_WARNING
Warning: Help given to the user.
Convenience wrapper for the core headers.
void regex_colors_dump_all(void)
Dump all the Regex colours to the log.
int color_debug(enum LogLevel level, const char *format,...)
Write to the log file.
const char * color_debug_log_attrs_list(int attrs)
Get a string to represent some attributes in the log.
const char * color_debug_log_name(char *buf, int buflen, int color)
Get a string to represent a colour name.
const char * color_debug_log_color_attrs(int fg, int bg, int attrs)
Get a colourful string to represent a colour in the log.
void curses_colors_dump(void)
Log all the Curses colours.
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
bool OptNoCurses
(pseudo) when sending in batch mode
enum CommandResult mutt_parse_unmono(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unmono' command - Implements Command::parse() -.
enum CommandResult mutt_parse_mono(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'mono' command - Implements Command::parse() -.
enum CommandResult mutt_parse_color(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'color' command - Implements Command::parse() -.
enum CommandResult mutt_parse_uncolor(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'uncolor' command - Implements Command::parse() -.
static enum CommandResult parse_color_pair(struct Buffer *buf, struct Buffer *s, uint32_t *fg, uint32_t *bg, int *attrs, struct Buffer *err)
Parse a pair of colours - Implements parser_callback_t -.
static enum CommandResult parse_attr_spec(struct Buffer *buf, struct Buffer *s, uint32_t *fg, uint32_t *bg, int *attrs, struct Buffer *err)
Parse an attribute description - Implements parser_callback_t -.
Convenience wrapper for the gui headers.
@ LL_DEBUG5
Log at debug level 5.
bool StartupComplete
When the config has been read.
int mutt_map_get_value(const char *name, const struct Mapping *map)
Lookup the constant for a string.
const char * mutt_map_get_name(int val, const struct Mapping *map)
Lookup a string for a constant.
struct AttrColorList MergedColors
Array of user colours.
Convenience wrapper for the library headers.
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
Many unsorted constants and some structs.
struct MuttWindow * window_get_focus(void)
Get the currently focused Window.
@ WT_CUSTOM
Window with a custom drawing function.
@ WT_PAGER
A panel containing the Pager Window.
@ NT_COLOR_SET
Color has been set.
@ NT_COLOR
Colour has changed, NotifyColor, EventColor.
#define TAILQ_FOREACH(var, head, field)
#define STAILQ_FOREACH(var, head, field)
#define STAILQ_EMPTY(head)
#define TAILQ_EMPTY(head)
enum CommandResult quoted_colors_parse_uncolor(enum ColorId cid, int q_level, struct Buffer *err)
Parse the 'uncolor quoted' command.
struct AttrColor * quoted_colors_get(int q)
Return the color of a quote, cycling through the used quotes.
int NumQuotedColors
Number of colours for quoted email text.
bool quoted_colors_parse_color(enum ColorId cid, uint32_t fg, uint32_t bg, int attrs, int q_level, int *rc, struct Buffer *err)
Parse the 'color quoted' command.
#define COLOR_QUOTES_MAX
Ten colours, quoted0..quoted9 (quoted and quoted0 are equivalent)
A curses colour and its attributes.
int attrs
Text attributes, e.g. A_BOLD.
struct CursesColor * curses_color
Underlying Curses colour.
String manipulation buffer.
char * dptr
Current read/write position.
char * data
Pointer to data.
Colour in the ncurses palette.
uint32_t fg
Foreground colour.
uint32_t bg
Background colour.
An Event that happened to a Colour.
enum ColorId cid
Colour ID that has changed.
Mapping between user-readable string and a constant.
const char * name
String value.
void * wdata
Private data.
struct MuttWindow * parent
Parent Window.
enum WindowType type
Window type, e.g. WT_SIDEBAR.
A regular expression and a color to highlight a line.
struct AttrColor attr_color
Colour and attributes to apply.
char * pattern
Pattern to match.
#define mutt_mktemp(buf, buflen)