NeoMutt  2024-12-12-14-g7b49f7
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
color.h File Reference

Color and attribute parsing. More...

#include "config.h"
#include "mutt/lib.h"
#include <stdbool.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.

Macros

#define COLOR_DEFAULT   -1
 

Enumerations

enum  ColorId {
  MT_COLOR_NONE , 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_ITALIC , 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_BACKGROUND , 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_STRIPE_EVEN ,
  MT_COLOR_STRIPE_ODD , MT_COLOR_TILDE , MT_COLOR_TREE , MT_COLOR_UNDERLINE ,
  MT_COLOR_WARNING , MT_COLOR_INDEX , MT_COLOR_INDEX_AUTHOR , MT_COLOR_INDEX_COLLAPSED ,
  MT_COLOR_INDEX_DATE , MT_COLOR_INDEX_FLAGS , MT_COLOR_INDEX_LABEL , MT_COLOR_INDEX_NUMBER ,
  MT_COLOR_INDEX_SIZE , MT_COLOR_INDEX_SUBJECT , MT_COLOR_INDEX_TAG , MT_COLOR_INDEX_TAGS ,
  MT_COLOR_MAX
}
 List of all coloured objects. More...
 

Functions

void colors_init (void)
 Initialize colours.
 
void colors_reset (void)
 Reset all the simple, quoted and regex colours.
 
void colors_cleanup (void)
 Cleanup all the colours.
 
bool mutt_color_has_pattern (enum ColorId cid)
 Check if a color object supports a regex pattern.
 

Variables

const struct Mapping ColorFields []
 Mapping of colour names to their IDs.
 
const struct Mapping ComposeColorFields []
 Mapping of compose colour names to their IDs.
 

Detailed Description

Color and attribute parsing.

Authors
  • R Primus
  • Richard Russon
  • Pietro Cerutti

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.

Macro Definition Documentation

◆ COLOR_DEFAULT

#define COLOR_DEFAULT   -1

Definition at line 96 of file color.h.

Enumeration Type Documentation

◆ ColorId

enum ColorId

List of all coloured objects.

Enumerator
MT_COLOR_NONE 

No colour.

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_ITALIC 

Italic text.

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_BACKGROUND 

Background colour for the Sidebar.

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_STRIPE_EVEN 

Stripes: even lines of the Help Page.

MT_COLOR_STRIPE_ODD 

Stripes: odd lines of the Help Page.

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.

MT_COLOR_INDEX_AUTHOR 

Index: author field.

MT_COLOR_INDEX_COLLAPSED 

Index: number of messages in collapsed thread.

MT_COLOR_INDEX_DATE 

Index: date field.

MT_COLOR_INDEX_FLAGS 

Index: flags 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_SUBJECT 

Index: subject field.

MT_COLOR_INDEX_TAG 

Index: tag field (G)

MT_COLOR_INDEX_TAGS 

Index: tags field (g, J)

MT_COLOR_MAX 

Definition at line 35 of file color.h.

36{
78 // Index colours which all take a pattern
91};
@ MT_COLOR_SIDEBAR_DIVIDER
Line dividing sidebar from the index/pager.
Definition: color.h:62
@ MT_COLOR_MARKERS
Pager: markers, line continuation.
Definition: color.h:52
@ MT_COLOR_COMPOSE_SECURITY_ENCRYPT
Mail will be encrypted.
Definition: color.h:44
@ MT_COLOR_MESSAGE
Informational message.
Definition: color.h:53
@ MT_COLOR_QUOTED
Pager: quoted text.
Definition: color.h:59
@ MT_COLOR_INDEX_AUTHOR
Index: author field.
Definition: color.h:80
@ MT_COLOR_MAX
Definition: color.h:90
@ MT_COLOR_SIDEBAR_NEW
Mailbox with new mail.
Definition: color.h:66
@ MT_COLOR_HEADER
Message headers (takes a pattern)
Definition: color.h:49
@ MT_COLOR_STATUS
Status bar (takes a pattern)
Definition: color.h:71
@ MT_COLOR_SIDEBAR_UNREAD
Mailbox with unread mail.
Definition: color.h:69
@ MT_COLOR_INDEX_SIZE
Index: size field.
Definition: color.h:86
@ MT_COLOR_INDICATOR
Selected item in list.
Definition: color.h:50
@ MT_COLOR_STRIPE_EVEN
Stripes: even lines of the Help Page.
Definition: color.h:72
@ MT_COLOR_SIDEBAR_SPOOLFILE
$spool_file (Spool mailbox)
Definition: color.h:68
@ MT_COLOR_ERROR
Error message.
Definition: color.h:47
@ MT_COLOR_NONE
No colour.
Definition: color.h:37
@ MT_COLOR_COMPOSE_SECURITY_NONE
Mail will not be encrypted or signed.
Definition: color.h:45
@ MT_COLOR_SIDEBAR_ORDINARY
Mailbox with no new or flagged messages.
Definition: color.h:67
@ MT_COLOR_INDEX_TAGS
Index: tags field (g, J)
Definition: color.h:89
@ MT_COLOR_BOLD
Bold text.
Definition: color.h:41
@ MT_COLOR_INDEX_SUBJECT
Index: subject field.
Definition: color.h:87
@ MT_COLOR_BODY
Pager: highlight body of message (takes a pattern)
Definition: color.h:40
@ MT_COLOR_INDEX_DATE
Index: date field.
Definition: color.h:82
@ MT_COLOR_PROGRESS
Progress bar.
Definition: color.h:57
@ MT_COLOR_COMPOSE_SECURITY_BOTH
Mail will be encrypted and signed.
Definition: color.h:43
@ MT_COLOR_SIDEBAR_BACKGROUND
Background colour for the Sidebar.
Definition: color.h:61
@ MT_COLOR_INDEX_TAG
Index: tag field (G)
Definition: color.h:88
@ MT_COLOR_HDRDEFAULT
Header default colour.
Definition: color.h:48
@ MT_COLOR_OPTIONS
Options in prompt.
Definition: color.h:56
@ MT_COLOR_TREE
Index: tree-drawing characters.
Definition: color.h:75
@ MT_COLOR_NORMAL
Plain text.
Definition: color.h:55
@ MT_COLOR_ATTACH_HEADERS
MIME attachment test (takes a pattern)
Definition: color.h:39
@ MT_COLOR_SEARCH
Pager: search matches.
Definition: color.h:60
@ MT_COLOR_COMPOSE_SECURITY_SIGN
Mail will be signed.
Definition: color.h:46
@ MT_COLOR_MESSAGE_LOG
Menu showing log messages.
Definition: color.h:54
@ MT_COLOR_INDEX_LABEL
Index: label field.
Definition: color.h:84
@ MT_COLOR_ITALIC
Italic text.
Definition: color.h:51
@ MT_COLOR_STRIPE_ODD
Stripes: odd lines of the Help Page.
Definition: color.h:73
@ MT_COLOR_PROMPT
Question/user input.
Definition: color.h:58
@ MT_COLOR_COMPOSE_HEADER
Header labels, e.g. From:
Definition: color.h:42
@ MT_COLOR_INDEX
Index: default colour.
Definition: color.h:79
@ MT_COLOR_ATTACHMENT
MIME attachments text (entire line)
Definition: color.h:38
@ MT_COLOR_SIDEBAR_INDICATOR
Current open mailbox.
Definition: color.h:65
@ MT_COLOR_SIDEBAR_HIGHLIGHT
Select cursor.
Definition: color.h:64
@ MT_COLOR_WARNING
Warning messages.
Definition: color.h:77
@ MT_COLOR_UNDERLINE
Underlined text.
Definition: color.h:76
@ MT_COLOR_INDEX_NUMBER
Index: index number.
Definition: color.h:85
@ MT_COLOR_SIGNATURE
Pager: signature lines.
Definition: color.h:70
@ MT_COLOR_INDEX_FLAGS
Index: flags field.
Definition: color.h:83
@ MT_COLOR_SIDEBAR_FLAGGED
Mailbox with flagged messages.
Definition: color.h:63
@ MT_COLOR_TILDE
Pager: empty lines after message.
Definition: color.h:74
@ MT_COLOR_INDEX_COLLAPSED
Index: number of messages in collapsed thread.
Definition: color.h:81

Function Documentation

◆ colors_init()

void colors_init ( void  )

Initialize colours.

Definition at line 49 of file color.c.

50{
51 color_debug(LL_DEBUG5, "init\n");
53
59
60 start_color();
61 use_default_colors();
62 color_debug(LL_DEBUG5, "COLORS = %d, COLOR_PAIRS = %d\n", COLORS, COLOR_PAIRS);
63}
void color_notify_init(struct Notify *parent)
Initialise the Colour notification.
Definition: notify.c:42
void regex_colors_init(void)
Initialise the Regex colours.
Definition: regex.c:68
void simple_colors_init(void)
Initialise the simple colour definitions.
Definition: simple.c:47
void curses_colors_init(void)
Initialise the Curses colours.
Definition: curses.c:44
static int color_debug(enum LogLevel level, const char *format,...)
Definition: debug.h:52
@ LL_DEBUG5
Log at debug level 5.
Definition: logging2.h:47
void merged_colors_init(void)
Initialise the Merged colours.
Definition: merged.c:44
void quoted_colors_init(void)
Initialise the Quoted colours.
Definition: quoted.c:49
Container for Accounts, Notifications.
Definition: neomutt.h:42
struct Notify * notify
Notifications handler.
Definition: neomutt.h:43
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ colors_reset()

void colors_reset ( void  )

Reset all the simple, quoted and regex colours.

Definition at line 68 of file color.c.

69{
70 color_debug(LL_DEBUG5, "reset\n");
71 mutt_debug(LL_NOTIFY, "NT_COLOR_RESET: [ALL]\n");
72
76
77 struct EventColor ev_c = { MT_COLOR_MAX, NULL };
79}
struct Notify * ColorsNotify
Notifications: ColorId, EventColor.
Definition: notify.c:36
void regex_colors_reset(void)
Reset the Regex colours.
Definition: regex.c:91
void simple_colors_reset(void)
Reset the simple colour definitions.
Definition: simple.c:70
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
@ LL_NOTIFY
Log of notifications.
Definition: logging2.h:48
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition: notify.c:173
@ NT_COLOR_RESET
Color has been reset/removed.
Definition: notify2.h:44
@ NT_COLOR
Colour has changed, NotifyColor, EventColor.
Definition: notify_type.h:41
void quoted_colors_reset(void)
Reset the quoted-email colours.
Definition: quoted.c:63
An Event that happened to a Colour.
Definition: notify2.h:55
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ colors_cleanup()

void colors_cleanup ( void  )

Cleanup all the colours.

Definition at line 84 of file color.c.

85{
91}
void color_notify_cleanup(void)
Free the Colour notification.
Definition: notify.c:51
void regex_colors_cleanup(void)
Cleanup the Regex colours.
Definition: regex.c:114
void simple_colors_cleanup(void)
Cleanup the simple colour definitions.
Definition: simple.c:83
void merged_colors_cleanup(void)
Free the list of Merged colours.
Definition: merged.c:52
void quoted_colors_cleanup(void)
Cleanup the quoted-email colours.
Definition: quoted.c:76
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_color_has_pattern()

bool mutt_color_has_pattern ( enum ColorId  cid)

Check if a color object supports a regex pattern.

Parameters
cidObject type, e.g. MT_COLOR_TILDE
Return values
trueThe color object supports patterns

Definition at line 98 of file color.c.

99{
100 return (cid == MT_COLOR_ATTACH_HEADERS) || (cid == MT_COLOR_BODY) ||
101 (cid == MT_COLOR_HEADER) || (cid == MT_COLOR_INDEX) ||
102 (cid == MT_COLOR_INDEX_AUTHOR) || (cid == MT_COLOR_INDEX_COLLAPSED) ||
103 (cid == MT_COLOR_INDEX_DATE) || (cid == MT_COLOR_INDEX_FLAGS) ||
104 (cid == MT_COLOR_INDEX_LABEL) || (cid == MT_COLOR_INDEX_NUMBER) ||
105 (cid == MT_COLOR_INDEX_SIZE) || (cid == MT_COLOR_INDEX_SUBJECT) ||
106 (cid == MT_COLOR_INDEX_TAG) || (cid == MT_COLOR_INDEX_TAGS) ||
107 (cid == MT_COLOR_STATUS);
108}
+ Here is the caller graph for this function:

Variable Documentation

◆ ColorFields

const struct Mapping ColorFields[]
extern

Mapping of colour names to their IDs.

Definition at line 56 of file command.c.

◆ ComposeColorFields

const struct Mapping ComposeColorFields[]
extern

Mapping of compose colour names to their IDs.

Definition at line 112 of file command.c.