NeoMutt  2025-12-11-911-gd8d604
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
color()

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

+ Collaboration diagram for color():

Functions

const struct AttrColorindex_color (struct Menu *menu, int line)
 Calculate the colour for a line of the index - Implements Menu::color() -.
 
static const struct AttrColordefault_color (struct Menu *menu, int line)
 Get the default colour for a line of the menu - Implements Menu::color() -.
 
static const struct AttrColorpost_color (struct Menu *menu, int line)
 Calculate the colour for a line of the postpone index - Implements Menu::color() -.
 

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()

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

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

Definition at line 948 of file dlg_index.c.

949{
950 struct IndexPrivateData *priv = menu->mdata;
951 struct IndexSharedData *shared = priv->shared;
952 struct Mailbox *m = shared->mailbox;
953 if (!m || (line < 0))
954 return NULL;
955
956 struct Email *e = mutt_get_virt_email(m, line);
957 if (!e)
958 return NULL;
959
960 if (e->attr_color)
961 return e->attr_color;
962
963 email_set_color(m, e);
964 return e->attr_color;
965}
void email_set_color(struct Mailbox *m, struct Email *e)
Select an Index colour for an Email.
Definition dlg_index.c:1431
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition mview.c:376
The envelope/body of an email.
Definition email.h:39
const struct AttrColor * attr_color
Color-pair to use when displaying in the index.
Definition email.h:112
Private state data for the Index.
struct IndexSharedData * shared
Shared Index data.
struct Menu * menu
Menu controlling the index.
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:81
void * mdata
Private data.
Definition lib.h:155
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ default_color()

static const 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 49 of file menu.c.

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

◆ post_color()

static const 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 212 of file dlg_postpone.c.

213{
214 struct PostponeData *pd = menu->mdata;
215 struct MailboxView *mv = pd->mailbox_view;
216 if (!mv || (line < 0))
217 return NULL;
218
219 struct Mailbox *m = mv->mailbox;
220 if (!m)
221 return NULL;
222
223 struct Email *e = mutt_get_virt_email(m, line);
224 if (!e)
225 return NULL;
226
227 if (e->attr_color)
228 return e->attr_color;
229
230 email_set_color(m, e);
231 return e->attr_color;
232}
View of a Mailbox.
Definition mview.h:40
struct Mailbox * mailbox
Current Mailbox.
Definition mview.h:51
Data to pass to the Postpone Functions.
Definition functions.h:35
struct MailboxView * mailbox_view
Postponed Mailbox view.
Definition functions.h:36
struct Menu * menu
Postponed Menu.
Definition functions.h:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function: