NeoMutt  2021-02-05-329-g9e03b7
Teaching an old dog new tricks
DOXYGEN
color.h File Reference

Color and attribute parsing. More...

#include "config.h"
#include <stdbool.h>
#include <stdint.h>
#include "mutt/lib.h"
#include "mutt_commands.h"
+ Include dependency graph for color.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ColorLine
 A regular expression and a color to highlight a line. More...
 
struct  EventColor
 An Event that happened to a Colour. More...
 

Enumerations

enum  ColorId {
  MT_COLOR_NONE = 50, MT_COLOR_ATTACHMENT, MT_COLOR_ATTACH_HEADERS, MT_COLOR_BODY,
  MT_COLOR_BOLD, MT_COLOR_COMPOSE_HEADER, MT_COLOR_COMPOSE_SECURITY_BOTH, MT_COLOR_COMPOSE_SECURITY_ENCRYPT,
  MT_COLOR_COMPOSE_SECURITY_NONE, MT_COLOR_COMPOSE_SECURITY_SIGN, MT_COLOR_ERROR, MT_COLOR_HDRDEFAULT,
  MT_COLOR_HEADER, MT_COLOR_INDICATOR, MT_COLOR_MARKERS, MT_COLOR_MESSAGE,
  MT_COLOR_MESSAGE_LOG, MT_COLOR_NORMAL, MT_COLOR_OPTIONS, MT_COLOR_PROGRESS,
  MT_COLOR_PROMPT, MT_COLOR_QUOTED, MT_COLOR_SEARCH, MT_COLOR_SIDEBAR_DIVIDER,
  MT_COLOR_SIDEBAR_FLAGGED, MT_COLOR_SIDEBAR_HIGHLIGHT, MT_COLOR_SIDEBAR_INDICATOR, MT_COLOR_SIDEBAR_NEW,
  MT_COLOR_SIDEBAR_ORDINARY, MT_COLOR_SIDEBAR_SPOOLFILE, MT_COLOR_SIDEBAR_UNREAD, MT_COLOR_SIGNATURE,
  MT_COLOR_STATUS, MT_COLOR_TILDE, MT_COLOR_TREE, MT_COLOR_UNDERLINE,
  MT_COLOR_WARNING, MT_COLOR_INDEX, MT_COLOR_INDEX_AUTHOR, MT_COLOR_INDEX_FLAGS,
  MT_COLOR_INDEX_SUBJECT, MT_COLOR_INDEX_TAG, MT_COLOR_INDEX_COLLAPSED, MT_COLOR_INDEX_DATE,
  MT_COLOR_INDEX_LABEL, MT_COLOR_INDEX_NUMBER, MT_COLOR_INDEX_SIZE, MT_COLOR_INDEX_TAGS,
  MT_COLOR_MAX
}
 List of all colored objects. More...
 
enum  NotifyColor { NT_COLOR_SET = 1, NT_COLOR_RESET }
 Types of Color Event. More...
 

Functions

 STAILQ_HEAD (ColorLineList, ColorLine)
 
bool mutt_color_is_header (enum ColorId color_id)
 Colour is for an Email header. More...
 
int mutt_color_alloc (uint32_t fg, uint32_t bg)
 Allocate a colour pair. More...
 
int mutt_color_combine (uint32_t fg_attr, uint32_t bg_attr)
 Combine two colours. More...
 
void mutt_color_free (uint32_t fg, uint32_t bg)
 Free a colour. More...
 
void mutt_colors_init (void)
 Initialize colours. More...
 
void mutt_colors_cleanup (void)
 Cleanup all the colours. More...
 
enum CommandResult mutt_parse_color (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'color' command - Implements Command::parse() More...
 
enum CommandResult mutt_parse_mono (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'mono' command - Implements Command::parse() More...
 
enum CommandResult mutt_parse_uncolor (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'uncolor' command - Implements Command::parse() More...
 
enum CommandResult mutt_parse_unmono (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'unmono' command - Implements Command::parse() More...
 
int mutt_color (enum ColorId id)
 Return the color of an object. More...
 
struct ColorLineList * mutt_color_status_line (void)
 Return the ColorLineList for the status_line. More...
 
struct ColorLineList * mutt_color_index (void)
 Return the ColorLineList for the index. More...
 
struct ColorLineList * mutt_color_headers (void)
 Return the ColorLineList for headers. More...
 
struct ColorLineList * mutt_color_body (void)
 Return the ColorLineList for the body. More...
 
struct ColorLineList * mutt_color_attachments (void)
 Return the ColorLineList for the attachments. More...
 
struct ColorLineList * mutt_color_index_author (void)
 Return the ColorLineList for author in the index. More...
 
struct ColorLineList * mutt_color_index_flags (void)
 Return the ColorLineList for flags in the index. More...
 
struct ColorLineList * mutt_color_index_subject (void)
 Return the ColorLineList for subject in the index. More...
 
struct ColorLineList * mutt_color_index_tags (void)
 Return the ColorLineList for tags in the index. More...
 
int mutt_color_quote (int quote)
 Return the color of a quote, cycling through the used quotes. More...
 
int mutt_color_quotes_used (void)
 Return the number of used quotes. More...
 
void mutt_color_observer_add (observer_t callback, void *global_data)
 Add an observer. More...
 
void mutt_color_observer_remove (observer_t callback, void *global_data)
 Remove an observer. More...
 

Detailed Description

Color and attribute parsing.

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file color.h.

Enumeration Type Documentation

◆ ColorId

enum ColorId

List of all colored objects.

This enumeration starts at 50 to avoid any of the values being 37 (ASCII %). Inserting colour codes into expando strings, when one of the colour codes was '', was causing formatting problems.

Enumerator
MT_COLOR_NONE 
MT_COLOR_ATTACHMENT 

MIME attachments text (entire line)

MT_COLOR_ATTACH_HEADERS 

MIME attachment test (takes a pattern)

MT_COLOR_BODY 

Pager: highlight body of message (takes a pattern)

MT_COLOR_BOLD 

Bold text.

MT_COLOR_COMPOSE_HEADER 

Header labels, e.g. From:

MT_COLOR_COMPOSE_SECURITY_BOTH 

Mail will be encrypted and signed.

MT_COLOR_COMPOSE_SECURITY_ENCRYPT 

Mail will be encrypted.

MT_COLOR_COMPOSE_SECURITY_NONE 

Mail will not be encrypted or signed.

MT_COLOR_COMPOSE_SECURITY_SIGN 

Mail will be signed.

MT_COLOR_ERROR 

Error message.

MT_COLOR_HDRDEFAULT 

Header default colour.

MT_COLOR_HEADER 

Message headers (takes a pattern)

MT_COLOR_INDICATOR 

Selected item in list.

MT_COLOR_MARKERS 

Pager: markers, line continuation.

MT_COLOR_MESSAGE 

Informational message.

MT_COLOR_MESSAGE_LOG 

Menu showing log messages.

MT_COLOR_NORMAL 

Plain text.

MT_COLOR_OPTIONS 

Options in prompt.

MT_COLOR_PROGRESS 

Progress bar.

MT_COLOR_PROMPT 

Question/user input.

MT_COLOR_QUOTED 

Pager: quoted text.

MT_COLOR_SEARCH 

Pager: search matches.

MT_COLOR_SIDEBAR_DIVIDER 

Line dividing sidebar from the index/pager.

MT_COLOR_SIDEBAR_FLAGGED 

Mailbox with flagged messages.

MT_COLOR_SIDEBAR_HIGHLIGHT 

Select cursor.

MT_COLOR_SIDEBAR_INDICATOR 

Current open mailbox.

MT_COLOR_SIDEBAR_NEW 

Mailbox with new mail.

MT_COLOR_SIDEBAR_ORDINARY 

Mailbox with no new or flagged messages.

MT_COLOR_SIDEBAR_SPOOLFILE 

$spool_file (Spool mailbox)

MT_COLOR_SIDEBAR_UNREAD 

Mailbox with unread mail.

MT_COLOR_SIGNATURE 

Pager: signature lines.

MT_COLOR_STATUS 

Status bar (takes a pattern)

MT_COLOR_TILDE 

Pager: empty lines after message.

MT_COLOR_TREE 

Index: tree-drawing characters.

MT_COLOR_UNDERLINE 

Underlined text.

MT_COLOR_WARNING 

Warning messages.

MT_COLOR_INDEX 

Index: default colour (takes a pattern)

MT_COLOR_INDEX_AUTHOR 

Index: author field (takes a pattern)

MT_COLOR_INDEX_FLAGS 

Index: flags field (takes a pattern)

MT_COLOR_INDEX_SUBJECT 

Index: subject field (takes a pattern)

MT_COLOR_INDEX_TAG 

Index: tag field (g, takes a pattern)

MT_COLOR_INDEX_COLLAPSED 

Index: number of messages in collapsed thread.

MT_COLOR_INDEX_DATE 

Index: date field.

MT_COLOR_INDEX_LABEL 

Index: label field.

MT_COLOR_INDEX_NUMBER 

Index: index number.

MT_COLOR_INDEX_SIZE 

Index: size field.

MT_COLOR_INDEX_TAGS 

Index: tags field (g, J)

MT_COLOR_MAX 

Definition at line 39 of file color.h.

40 {
41  MT_COLOR_NONE = 50,
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 };
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
Informational message.
Definition: color.h:56
Pager: highlight body of message (takes a pattern)
Definition: color.h:44
Mailbox with no new or flagged messages.
Definition: color.h:70
Line dividing sidebar from the index/pager.
Definition: color.h:65
Pager: signature lines.
Definition: color.h:74
Select cursor.
Definition: color.h:67
Pager: quoted text.
Definition: color.h:62
Index: number of messages in collapsed thread.
Definition: color.h:87
Mailbox with new mail.
Definition: color.h:69
Current open mailbox.
Definition: color.h:68
Menu showing log messages.
Definition: color.h:57
Index: author field (takes a pattern)
Definition: color.h:82
Pager: empty lines after message.
Definition: color.h:76
Message headers (takes a pattern)
Definition: color.h:53
Index: tag field (g, takes a pattern)
Definition: color.h:85
Index: tree-drawing characters.
Definition: color.h:77
Pager: markers, line continuation.
Definition: color.h:55
Plain text.
Definition: color.h:58
Index: date field.
Definition: color.h:88
Index: size field.
Definition: color.h:91
Status bar (takes a pattern)
Definition: color.h:75
Header labels, e.g. From:
Definition: color.h:46
Selected item in list.
Definition: color.h:54
Mail will be signed.
Definition: color.h:50
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
MIME attachments text (entire line)
Definition: color.h:42
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
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
$spool_file (Spool mailbox)
Definition: color.h:71

◆ NotifyColor

Types of Color Event.

Observers of NT_COLOR will be passed an EventColor.

Enumerator
NT_COLOR_SET 

A new Color has been set.

NT_COLOR_RESET 

Color has been reset/removed.

Definition at line 132 of file color.h.

133 {
134  NT_COLOR_SET = 1,
136 };
A new Color has been set.
Definition: color.h:134
Color has been reset/removed.
Definition: color.h:135

Function Documentation

◆ STAILQ_HEAD()

STAILQ_HEAD ( ColorLineList  ,
ColorLine   
)

◆ mutt_color_is_header()

bool mutt_color_is_header ( enum ColorId  color_id)

Colour is for an Email header.

Parameters
color_idColour, e.g. MT_COLOR_HEADER
Return values
trueColour is for an Email header

Definition at line 1526 of file color.c.

1527 {
1528  return (color_id == MT_COLOR_HEADER) || (color_id == MT_COLOR_HDRDEFAULT);
1529 }
Header default colour.
Definition: color.h:52
Message headers (takes a pattern)
Definition: color.h:53
+ Here is the caller graph for this function:

◆ mutt_color_alloc()

int mutt_color_alloc ( uint32_t  fg,
uint32_t  bg 
)

Allocate a colour pair.

Parameters
fgForeground colour ID
bgBackground colour ID
Return values
numCombined colour pair

Definition at line 478 of file color.c.

479 {
480 #ifdef USE_SLANG_CURSES
481  char fgc[128], bgc[128];
482 #endif
483  struct ColorList *p = Colors.user_colors;
484 
485  /* check to see if this color is already allocated to save space */
486  while (p)
487  {
488  if ((p->fg == fg) && (p->bg == bg))
489  {
490  (p->count)++;
491  return COLOR_PAIR(p->index);
492  }
493  p = p->next;
494  }
495 
496  /* check to see if there are colors left */
497  if (++Colors.num_user_colors > COLOR_PAIRS)
498  return A_NORMAL;
499 
500  /* find the smallest available index (object) */
501  int i = 1;
502  while (true)
503  {
504  p = Colors.user_colors;
505  while (p)
506  {
507  if (p->index == i)
508  break;
509  p = p->next;
510  }
511  if (!p)
512  break;
513  i++;
514  }
515 
516  p = mutt_mem_malloc(sizeof(struct ColorList));
517  p->next = Colors.user_colors;
518  Colors.user_colors = p;
519 
520  p->index = i;
521  p->count = 1;
522  p->bg = bg;
523  p->fg = fg;
524 
525 #ifdef USE_SLANG_CURSES
526  /*
527  * If using s-lang always use SLtt_set_color which allows using truecolor
528  * values. Note that I couldn't figure out if s-lang somehow reports
529  * truecolor support.
530  */
531  SLtt_set_color(i, NULL, get_color_name(fgc, sizeof(fgc), fg),
532  get_color_name(bgc, sizeof(bgc), bg));
533 #else
534 #ifdef HAVE_USE_DEFAULT_COLORS
535  if (fg == COLOR_DEFAULT)
536  fg = COLOR_UNSET;
537  if (bg == COLOR_DEFAULT)
538  bg = COLOR_UNSET;
539 #endif
540  init_pair(i, fg, bg);
541 #endif
542 
543  mutt_debug(LL_DEBUG3, "Color pairs used so far: %d\n", Colors.num_user_colors);
544 
545  return COLOR_PAIR(p->index);
546 }
#define COLOR_UNSET
Definition: color.c:52
#define COLOR_DEFAULT
Definition: color.c:128
short count
Definition: color.c:66
short index
Definition: color.c:65
uint32_t bg
Definition: color.c:64
struct ColorList * next
Definition: color.c:67
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
Definition: memory.c:90
uint32_t fg
Definition: color.c:63
A set of colors.
Definition: color.c:59
#define mutt_debug(LEVEL,...)
Definition: logging.h:81
Log at debug level 3.
Definition: logging.h:42
static struct @2 Colors
Wrapper for all the colours.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_color_combine()

int mutt_color_combine ( uint32_t  fg_attr,
uint32_t  bg_attr 
)

Combine two colours.

Parameters
fg_attrColour pair of foreground to use
bg_attrColour pair of background to use
Return values
numColour pair of combined colour

Definition at line 581 of file color.c.

582 {
583  uint32_t fg = COLOR_DEFAULT;
584  uint32_t bg = COLOR_DEFAULT;
585 
586  mutt_lookup_color(fg_attr, &fg, NULL);
587  mutt_lookup_color(bg_attr, NULL, &bg);
588 
589  if ((fg == COLOR_DEFAULT) && (bg == COLOR_DEFAULT))
590  return A_NORMAL;
591  return mutt_color_alloc(fg, bg);
592 }
#define COLOR_DEFAULT
Definition: color.c:128
int mutt_color_alloc(uint32_t fg, uint32_t bg)
Allocate a colour pair.
Definition: color.c:478
static int mutt_lookup_color(short pair, uint32_t *fg, uint32_t *bg)
Get the colours from a colour pair.
Definition: color.c:556
uint32_t bg
Definition: color.c:64
uint32_t fg
Definition: color.c:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_color_free()

void mutt_color_free ( uint32_t  fg,
uint32_t  bg 
)

Free a colour.

Parameters
fgForeground colour ID
bgBackground colour ID

If there are no more users, the resource will be freed.

Definition at line 284 of file color.c.

285 {
286  struct ColorList *q = NULL;
287 
288  struct ColorList *p = Colors.user_colors;
289  while (p)
290  {
291  if ((p->fg == fg) && (p->bg == bg))
292  {
293  (p->count)--;
294  if (p->count > 0)
295  return;
296 
297  Colors.num_user_colors--;
298  mutt_debug(LL_DEBUG1, "Color pairs used so far: %d\n", Colors.num_user_colors);
299 
300  if (p == Colors.user_colors)
301  {
302  Colors.user_colors = Colors.user_colors->next;
303  FREE(&p);
304  return;
305  }
306  q = Colors.user_colors;
307  while (q)
308  {
309  if (q->next == p)
310  {
311  q->next = p->next;
312  FREE(&p);
313  return;
314  }
315  q = q->next;
316  }
317  /* can't get here */
318  }
319  p = p->next;
320  }
321 }
short count
Definition: color.c:66
uint32_t bg
Definition: color.c:64
struct ColorList * next
Definition: color.c:67
uint32_t fg
Definition: color.c:63
Log at debug level 1.
Definition: logging.h:40
A set of colors.
Definition: color.c:59
#define FREE(x)
Definition: memory.h:40
#define mutt_debug(LEVEL,...)
Definition: logging.h:81
static struct @2 Colors
Wrapper for all the colours.
+ Here is the caller graph for this function:

◆ mutt_colors_init()

void mutt_colors_init ( void  )

Initialize colours.

Definition at line 393 of file color.c.

394 {
395  Colors.notify = notify_new();
396 
397  quotes_init();
398  defs_init();
399 
400 #ifdef HAVE_COLOR
401  start_color();
402 #endif
403 
405 }
static void defs_init(void)
Initialise the simple colour definitions.
Definition: color.c:216
Container for Accounts, Notifications.
Definition: neomutt.h:36
struct Notify * notify_new(void)
Create a new notifications handler.
Definition: notify.c:49
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
static void quotes_init(void)
Initialise the quoted-email colours.
Definition: color.c:241
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
Definition: notify.c:82
static struct @2 Colors
Wrapper for all the colours.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_colors_cleanup()

void mutt_colors_cleanup ( void  )

Cleanup all the colours.

Definition at line 384 of file color.c.

385 {
386  colors_clear();
387  notify_free(&Colors.notify);
388 }
void notify_free(struct Notify **ptr)
Free a notification handler.
Definition: notify.c:62
static void colors_clear(void)
Reset all the colours.
Definition: color.c:363
static struct @2 Colors
Wrapper for all the colours.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_parse_color()

enum CommandResult mutt_parse_color ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'color' command - Implements Command::parse()

Definition at line 1357 of file color.c.

1359 {
1360  bool dry_run = false;
1361 
1362  if (OptNoCurses || !has_colors())
1363  dry_run = true;
1364 
1365  return parse_color(buf, s, err, parse_color_pair, dry_run, true);
1366 }
WHERE bool OptNoCurses
(pseudo) when sending in batch mode
Definition: options.h:48
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 &#39;color&#39; command.
Definition: color.c:1183
static enum CommandResult parse_color_pair(struct Buffer *buf, struct Buffer *s, uint32_t *fg, uint32_t *bg, int *attr, struct Buffer *err)
Parse a pair of colours - Implements parser_callback_t.
Definition: color.c:1066
+ Here is the call graph for this function:

◆ mutt_parse_mono()

enum CommandResult mutt_parse_mono ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'mono' command - Implements Command::parse()

Definition at line 1372 of file color.c.

1374 {
1375  bool dry_run = false;
1376 
1377 #ifdef HAVE_COLOR
1378  if (OptNoCurses || has_colors())
1379  dry_run = true;
1380 #else
1381  if (OptNoCurses)
1382  dry_run = true;
1383 #endif
1384 
1385  return parse_color(buf, s, err, parse_attr_spec, dry_run, false);
1386 }
WHERE bool OptNoCurses
(pseudo) when sending in batch mode
Definition: options.h:48
static enum CommandResult parse_attr_spec(struct Buffer *buf, struct Buffer *s, uint32_t *fg, uint32_t *bg, int *attr, struct Buffer *err)
Parse an attribute description - Implements parser_callback_t.
Definition: color.c:1116
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 &#39;color&#39; command.
Definition: color.c:1183
+ Here is the call graph for this function:

◆ mutt_parse_uncolor()

enum CommandResult mutt_parse_uncolor ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'uncolor' command - Implements Command::parse()

Definition at line 923 of file color.c.

925 {
926  if (OptNoCurses || !has_colors())
927  {
928  *s->dptr = '\0'; /* fake that we're done parsing */
929  return MUTT_CMD_SUCCESS;
930  }
931  return parse_uncolor(buf, s, err, true);
932 }
static enum CommandResult parse_uncolor(struct Buffer *buf, struct Buffer *s, struct Buffer *err, bool uncolor)
Parse an &#39;uncolor&#39; command.
Definition: color.c:822
WHERE bool OptNoCurses
(pseudo) when sending in batch mode
Definition: options.h:48
char * dptr
Current read/write position.
Definition: buffer.h:36
Success: Command worked.
Definition: mutt_commands.h:38
+ Here is the call graph for this function:

◆ mutt_parse_unmono()

enum CommandResult mutt_parse_unmono ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'unmono' command - Implements Command::parse()

Definition at line 938 of file color.c.

940 {
941  if (OptNoCurses || !has_colors())
942  {
943  *s->dptr = '\0'; /* fake that we're done parsing */
944  return MUTT_CMD_SUCCESS;
945  }
946  return parse_uncolor(buf, s, err, false);
947 }
static enum CommandResult parse_uncolor(struct Buffer *buf, struct Buffer *s, struct Buffer *err, bool uncolor)
Parse an &#39;uncolor&#39; command.
Definition: color.c:822
WHERE bool OptNoCurses
(pseudo) when sending in batch mode
Definition: options.h:48
char * dptr
Current read/write position.
Definition: buffer.h:36
Success: Command worked.
Definition: mutt_commands.h:38
+ Here is the call graph for this function:

◆ mutt_color()

int mutt_color ( enum ColorId  id)

Return the color of an object.

Parameters
idObject id
Return values
numColor ID, e.g. MT_COLOR_HEADER

Definition at line 1393 of file color.c.

1394 {
1395  return Colors.defs[id];
1396 }
static struct @2 Colors
Wrapper for all the colours.
+ Here is the caller graph for this function:

◆ mutt_color_status_line()

struct ColorLineList* mutt_color_status_line ( void  )

Return the ColorLineList for the status_line.

Return values
ptrColorLineList

Definition at line 1402 of file color.c.

1403 {
1404  return get_color_line_list(&Colors.status_list);
1405 }
static struct ColorLineList * get_color_line_list(struct ColorLineList *cll)
Sanitize and return a ColorLineList.
Definition: color.c:103
static struct @2 Colors
Wrapper for all the colours.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_color_index()

struct ColorLineList* mutt_color_index ( void  )

Return the ColorLineList for the index.

Return values
ptrColorLineList

Definition at line 1411 of file color.c.

1412 {
1413  return get_color_line_list(&Colors.index_list);
1414 }
static struct ColorLineList * get_color_line_list(struct ColorLineList *cll)
Sanitize and return a ColorLineList.
Definition: color.c:103
static struct @2 Colors
Wrapper for all the colours.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_color_headers()

struct ColorLineList* mutt_color_headers ( void  )

Return the ColorLineList for headers.

Return values
ptrColorLineList

Definition at line 1420 of file color.c.

1421 {
1422  return get_color_line_list(&Colors.hdr_list);
1423 }
static struct ColorLineList * get_color_line_list(struct ColorLineList *cll)
Sanitize and return a ColorLineList.
Definition: color.c:103
static struct @2 Colors
Wrapper for all the colours.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_color_body()

struct ColorLineList* mutt_color_body ( void  )

Return the ColorLineList for the body.

Return values
ptrColorLineList

Definition at line 1429 of file color.c.

1430 {
1431  return get_color_line_list(&Colors.body_list);
1432 }
static struct ColorLineList * get_color_line_list(struct ColorLineList *cll)
Sanitize and return a ColorLineList.
Definition: color.c:103
static struct @2 Colors
Wrapper for all the colours.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_color_attachments()

struct ColorLineList* mutt_color_attachments ( void  )

Return the ColorLineList for the attachments.

Return values
ptrColorLineList

Definition at line 1438 of file color.c.

1439 {
1440  return get_color_line_list(&Colors.attach_list);
1441 }
static struct ColorLineList * get_color_line_list(struct ColorLineList *cll)
Sanitize and return a ColorLineList.
Definition: color.c:103
static struct @2 Colors
Wrapper for all the colours.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_color_index_author()

struct ColorLineList* mutt_color_index_author ( void  )

Return the ColorLineList for author in the index.

Return values
ptrColorLineList

Definition at line 1447 of file color.c.

1448 {
1449  return get_color_line_list(&Colors.index_author_list);
1450 }
static struct ColorLineList * get_color_line_list(struct ColorLineList *cll)
Sanitize and return a ColorLineList.
Definition: color.c:103
static struct @2 Colors
Wrapper for all the colours.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_color_index_flags()

struct ColorLineList* mutt_color_index_flags ( void  )

Return the ColorLineList for flags in the index.

Return values
ptrColorLineList

Definition at line 1456 of file color.c.

1457 {
1458  return get_color_line_list(&Colors.index_flags_list);
1459 }
static struct ColorLineList * get_color_line_list(struct ColorLineList *cll)
Sanitize and return a ColorLineList.
Definition: color.c:103
static struct @2 Colors
Wrapper for all the colours.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_color_index_subject()

struct ColorLineList* mutt_color_index_subject ( void  )

Return the ColorLineList for subject in the index.

Return values
ptrColorLineList

Definition at line 1465 of file color.c.

1466 {
1467  return get_color_line_list(&Colors.index_subject_list);
1468 }
static struct ColorLineList * get_color_line_list(struct ColorLineList *cll)
Sanitize and return a ColorLineList.
Definition: color.c:103
static struct @2 Colors
Wrapper for all the colours.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_color_index_tags()

struct ColorLineList* mutt_color_index_tags ( void  )

Return the ColorLineList for tags in the index.

Return values
ptrColorLineList

Definition at line 1474 of file color.c.

1475 {
1476  return get_color_line_list(&Colors.index_tag_list);
1477 }
static struct ColorLineList * get_color_line_list(struct ColorLineList *cll)
Sanitize and return a ColorLineList.
Definition: color.c:103
static struct @2 Colors
Wrapper for all the colours.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_color_quote()

int mutt_color_quote ( int  q)

Return the color of a quote, cycling through the used quotes.

Parameters
qQuote number
Return values
numColor ID, e.g. MT_COLOR_QUOTED

Definition at line 1484 of file color.c.

1485 {
1486  const int used = Colors.quotes_used;
1487  if (used == 0)
1488  return 0;
1489  return Colors.quotes[q % used];
1490 }
static struct @2 Colors
Wrapper for all the colours.
+ Here is the caller graph for this function:

◆ mutt_color_quotes_used()

int mutt_color_quotes_used ( void  )

Return the number of used quotes.

Return values
numNumber of used quotes

Definition at line 1496 of file color.c.

1497 {
1498  return Colors.quotes_used;
1499 }
static struct @2 Colors
Wrapper for all the colours.
+ Here is the caller graph for this function:

◆ mutt_color_observer_add()

void mutt_color_observer_add ( observer_t  callback,
void *  global_data 
)

Add an observer.

Parameters
callbackThe callback
global_dataThe data

Definition at line 1506 of file color.c.

1507 {
1508  notify_observer_add(Colors.notify, NT_COLOR, callback, global_data);
1509 }
bool notify_observer_add(struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data)
Add an observer to an object.
Definition: notify.c:173
Colour has changed, NotifyColor, EventColor.
Definition: notify_type.h:39
static struct @2 Colors
Wrapper for all the colours.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_color_observer_remove()

void mutt_color_observer_remove ( observer_t  callback,
void *  global_data 
)

Remove an observer.

Parameters
callbackThe callback
global_dataThe data

Definition at line 1516 of file color.c.

1517 {
1518  notify_observer_remove(Colors.notify, callback, global_data);
1519 }
bool notify_observer_remove(struct Notify *notify, observer_t callback, void *global_data)
Remove an observer from an object.
Definition: notify.c:212
static struct @2 Colors
Wrapper for all the colours.
+ Here is the call graph for this function:
+ Here is the caller graph for this function: