NeoMutt  2023-05-17-33-gce4425
Teaching an old dog new tricks
DOXYGEN
color()

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

+ Collaboration diagram for color():

Functions

struct AttrColorindex_color (struct Menu *menu, int line)
 Calculate the colour for a line of the index - Implements Menu::color() -. More...
 
static struct AttrColordefault_color (struct Menu *menu, int line)
 Get the default colour for a line of the menu - Implements Menu::color() -. More...
 
static struct AttrColorpost_color (struct Menu *menu, int line)
 Calculate the colour for a line of the postpone index - 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()

struct AttrColor * index_color ( struct Menu menu,
int  line 
)

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

Definition at line 894 of file dlg_index.c.

895{
896 struct IndexPrivateData *priv = menu->mdata;
897 struct IndexSharedData *shared = priv->shared;
898 struct Mailbox *m = shared->mailbox;
899 if (!m || (line < 0))
900 return NULL;
901
902 struct Email *e = mutt_get_virt_email(m, line);
903 if (!e)
904 return NULL;
905
906 if (e->attr_color)
907 return e->attr_color;
908
910 return e->attr_color;
911}
void mutt_set_header_color(struct Mailbox *m, struct Email *e)
Select a colour for a message.
Definition: dlg_index.c:1379
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition: mview.c:407
The envelope/body of an email.
Definition: email.h:37
struct AttrColor * attr_color
Color-pair to use when displaying in the index.
Definition: email.h:111
Private state data for the Index.
Definition: private_data.h:35
struct IndexSharedData * shared
Shared Index data.
Definition: private_data.h:42
struct Menu * menu
Menu controlling the index.
Definition: private_data.h:43
Data shared between Index, Pager and Sidebar.
Definition: shared_data.h:37
struct Mailbox * mailbox
Current Mailbox.
Definition: shared_data.h:41
A mailbox.
Definition: mailbox.h:79
void * mdata
Private data.
Definition: lib.h:138
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ default_color()

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

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

Definition at line 47 of file menu.c.

48{
50}
struct AttrColor * simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
Definition: simple.c:74
@ MT_COLOR_NORMAL
Plain text.
Definition: color.h:57
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ post_color()

static struct AttrColor * post_color ( struct Menu menu,
int  line 
)
static

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

Definition at line 169 of file dlg_postpone.c.

170{
171 struct MailboxView *mv = menu->mdata;
172 if (!mv || (line < 0))
173 return NULL;
174
175 struct Mailbox *m = mv->mailbox;
176 if (!m)
177 return NULL;
178
179 struct Email *e = mutt_get_virt_email(m, line);
180 if (!e)
181 return NULL;
182
183 if (e->attr_color)
184 return e->attr_color;
185
187 return e->attr_color;
188}
View of a Mailbox.
Definition: mview.h:39
struct Menu * menu
Needed for pattern compilation.
Definition: mview.h:46
struct Mailbox * mailbox
Current Mailbox.
Definition: mview.h:50
+ Here is the call graph for this function:
+ Here is the caller graph for this function: