NeoMutt  2023-03-22
Teaching an old dog new tricks
DOXYGEN
color.c File Reference

Color and attribute parsing. More...

#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include "mutt/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "lib.h"
+ Include dependency graph for color.c:

Go to the source code of this file.

Functions

void colors_clear (void)
 Reset all the simple, quoted and regex colours. More...
 
void mutt_colors_cleanup (void)
 Cleanup all the colours. More...
 
void mutt_colors_init (void)
 Initialize colours. More...
 
bool mutt_color_has_pattern (enum ColorId cid)
 Check if a color object supports a regex pattern. More...
 

Variables

const struct Mapping ColorNames []
 

Detailed Description

Color and attribute parsing.

Authors
  • Michael R. Elkins
  • R Primus

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.c.

Function Documentation

◆ colors_clear()

void colors_clear ( void  )

Reset all the simple, quoted and regex colours.

Definition at line 56 of file color.c.

57{
58 color_debug(LL_DEBUG5, "clean up\n");
59 mutt_debug(LL_NOTIFY, "NT_COLOR_RESET: [ALL]\n");
60 struct EventColor ev_c = { MT_COLOR_MAX, NULL };
62
66}
struct Notify * ColorsNotify
Notifications: ColorId, EventColor.
Definition: notify.c:34
void regex_colors_clear(void)
Clear the Regex colours.
Definition: regex.c:91
void simple_colors_clear(void)
Reset the simple colour definitions.
Definition: simple.c:58
@ MT_COLOR_MAX
Definition: color.h:92
int color_debug(enum LogLevel level, const char *format,...)
Write to the log file.
Definition: debug.c:44
#define mutt_debug(LEVEL,...)
Definition: logging.h:84
@ LL_DEBUG5
Log at debug level 5.
Definition: logging.h:44
@ LL_NOTIFY
Log of notifications.
Definition: logging.h:45
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition: notify.c:171
@ NT_COLOR_RESET
Color has been reset/removed.
Definition: notify2.h:42
@ NT_COLOR
Colour has changed, NotifyColor, EventColor.
Definition: notify_type.h:41
void quoted_colors_clear(void)
Reset the quoted-email colours.
Definition: quoted.c:57
An Event that happened to a Colour.
Definition: notify2.h:53
+ 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 71 of file color.c.

72{
76}
void color_notify_free(void)
Free the Colour notification.
Definition: notify.c:48
void colors_clear(void)
Reset all the simple, quoted and regex colours.
Definition: color.c:56
void merged_colors_clear(void)
Free the list of Merged colours.
Definition: merged.c:54
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_colors_init()

void mutt_colors_init ( void  )

Initialize colours.

Definition at line 81 of file color.c.

82{
83 color_debug(LL_DEBUG5, "init\n");
89
90 start_color();
91 use_default_colors();
92 color_debug(LL_DEBUG5, "COLORS = %d, COLOR_PAIRS = %d\n", COLORS, COLOR_PAIRS);
93
95}
void color_notify_init(void)
Initialise the Colour notification.
Definition: notify.c:39
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:42
void curses_colors_init(void)
Initialise the Curses colours.
Definition: curses.c:42
void merged_colors_init(void)
Initialise the Merged colours.
Definition: merged.c:46
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
Definition: notify.c:93
Container for Accounts, Notifications.
Definition: neomutt.h:37
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
+ 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 103 of file color.c.

104{
105 return (cid == MT_COLOR_ATTACH_HEADERS) || (cid == MT_COLOR_BODY) ||
106 (cid == MT_COLOR_HEADER) || (cid == MT_COLOR_INDEX) ||
107 (cid == MT_COLOR_INDEX_AUTHOR) || (cid == MT_COLOR_INDEX_COLLAPSED) ||
108 (cid == MT_COLOR_INDEX_DATE) || (cid == MT_COLOR_INDEX_FLAGS) ||
109 (cid == MT_COLOR_INDEX_LABEL) || (cid == MT_COLOR_INDEX_NUMBER) ||
110 (cid == MT_COLOR_INDEX_SIZE) || (cid == MT_COLOR_INDEX_SUBJECT) ||
111 (cid == MT_COLOR_INDEX_TAG) || (cid == MT_COLOR_INDEX_TAGS) ||
112 (cid == MT_COLOR_STATUS);
113}
@ MT_COLOR_INDEX_AUTHOR
Index: author field.
Definition: color.h:82
@ MT_COLOR_HEADER
Message headers (takes a pattern)
Definition: color.h:51
@ MT_COLOR_STATUS
Status bar (takes a pattern)
Definition: color.h:75
@ MT_COLOR_INDEX_SIZE
Index: size field.
Definition: color.h:88
@ MT_COLOR_INDEX_TAGS
Index: tags field (g, J)
Definition: color.h:91
@ MT_COLOR_INDEX_SUBJECT
Index: subject field.
Definition: color.h:89
@ MT_COLOR_BODY
Pager: highlight body of message (takes a pattern)
Definition: color.h:42
@ MT_COLOR_INDEX_DATE
Index: date field.
Definition: color.h:84
@ MT_COLOR_INDEX_TAG
Index: tag field (G)
Definition: color.h:90
@ MT_COLOR_ATTACH_HEADERS
MIME attachment test (takes a pattern)
Definition: color.h:41
@ MT_COLOR_INDEX_LABEL
Index: label field.
Definition: color.h:86
@ MT_COLOR_INDEX
Index: default colour.
Definition: color.h:81
@ MT_COLOR_INDEX_NUMBER
Index: index number.
Definition: color.h:87
@ MT_COLOR_INDEX_FLAGS
Index: flags field.
Definition: color.h:85
@ MT_COLOR_INDEX_COLLAPSED
Index: number of messages in collapsed thread.
Definition: color.h:83
+ Here is the caller graph for this function:

Variable Documentation

◆ ColorNames

const struct Mapping ColorNames[]
Initial value:
= {
{ "black", COLOR_BLACK },
{ "blue", COLOR_BLUE },
{ "cyan", COLOR_CYAN },
{ "green", COLOR_GREEN },
{ "magenta", COLOR_MAGENTA },
{ "red", COLOR_RED },
{ "white", COLOR_WHITE },
{ "yellow", COLOR_YELLOW },
{ "default", COLOR_DEFAULT },
{ 0, 0 },
}
#define COLOR_DEFAULT
Definition: color.h:102

Definition at line 38 of file color.c.