NeoMutt  2021-02-05-666-ge300cd
Teaching an old dog new tricks
DOXYGEN
color()

Calculate the colour for a line of the menu. More...

+ Collaboration diagram for color():

Functions

int index_color (struct Menu *menu, int line)
 Calculate the colour for a line of the index - Implements Menu::color() -. More...
 
static int default_color (struct Menu *menu, int line)
 Get the default colour for a line of the menu - Implements Menu::color() -. More...
 

Detailed Description

Calculate the colour for a line of the menu.

Parameters
menuMenu containing items
lineMenu line number
Return values
>0Colour pair in an integer
0No colour

Function Documentation

◆ index_color()

int index_color ( struct Menu menu,
int  line 
)

Calculate the colour for a line of the index - Implements Menu::color() -.

Definition at line 843 of file dlg_index.c.

844 {
845  struct IndexPrivateData *priv = menu->mdata;
846  struct IndexSharedData *shared = priv->shared;
847  struct Mailbox *m = shared->mailbox;
848  if (!m || (line < 0))
849  return 0;
850 
851  struct Email *e = mutt_get_virt_email(m, line);
852  if (!e)
853  return 0;
854 
855  if (e->pair)
856  return e->pair;
857 
858  mutt_set_header_color(m, e);
859  return e->pair;
860 }
struct IndexSharedData * shared
Shared Index data.
Definition: private_data.h:43
The envelope/body of an email.
Definition: email.h:37
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition: context.c:412
Private state data for the Index.
Definition: private_data.h:34
void mutt_set_header_color(struct Mailbox *m, struct Email *e)
Select a colour for a message.
Definition: dlg_index.c:1382
Data shared between Index, Pager and Sidebar.
Definition: shared_data.h:36
void * mdata
Private data.
Definition: lib.h:155
A mailbox.
Definition: mailbox.h:81
struct Mailbox * mailbox
Current Mailbox.
Definition: shared_data.h:41
int pair
Color-pair to use when displaying in the index.
Definition: email.h:80
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ default_color()

static int default_color ( struct Menu menu,
int  line 
)
static

Get the default colour for a line of the menu - Implements Menu::color() -.

Definition at line 89 of file menu.c.

90 {
92 }
Plain text.
Definition: color.h:58
int mutt_color(enum ColorId id)
Return the color of an object.
Definition: color.c:1427
+ Here is the call graph for this function:
+ Here is the caller graph for this function: