NeoMutt  2025-12-11-769-g906513
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
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 "color.h"
#include "curses2.h"
#include "debug.h"
#include "merged.h"
#include "module_data.h"
#include "notify2.h"
#include "quoted.h"
#include "regex4.h"
#include "simple2.h"
+ Include dependency graph for color.c:

Go to the source code of this file.

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.
 

Detailed Description

Color and attribute parsing.

Authors
  • Richard Russon
  • R Primus
  • 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.c.

Function Documentation

◆ colors_init()

void colors_init ( void )

Initialize colours.

Definition at line 50 of file color.c.

51{
52 color_debug(LL_DEBUG5, "init\n");
54
60
61 start_color();
62 use_default_colors();
63 color_debug(LL_DEBUG5, "COLORS = %d, COLOR_PAIRS = %d\n", COLORS, COLOR_PAIRS);
64}
void color_notify_init(struct Notify *parent)
Initialise the Colour notification.
Definition notify.c:41
void regex_colors_init(void)
Initialise the Regex colours.
Definition regex.c:51
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:43
static int color_debug(enum LogLevel level, const char *format,...)
Definition debug.h:51
@ LL_DEBUG5
Log at debug level 5.
Definition logging2.h:49
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:73
Container for Accounts, Notifications.
Definition neomutt.h:41
struct Notify * notify
Notifications handler.
Definition neomutt.h:45
+ 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 69 of file color.c.

70{
71 color_debug(LL_DEBUG5, "reset\n");
72 mutt_debug(LL_NOTIFY, "NT_COLOR_RESET: [ALL]\n");
73
77
79 struct EventColor ev_c = { MT_COLOR_MAX, NULL };
81}
void regex_colors_reset(void)
Reset the Regex colours.
Definition regex.c:75
void simple_colors_reset(void)
Reset the simple colour definitions.
Definition simple.c:71
@ MT_COLOR_MAX
Definition color.h:97
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
@ LL_NOTIFY
Log of notifications.
Definition logging2.h:50
@ MODULE_ID_COLOR
ModuleColor, Color
Definition module_api.h:53
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
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:665
@ NT_COLOR_RESET
Color has been reset/removed.
Definition notify2.h:41
@ 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:81
Color private Module data.
Definition module_data.h:35
struct Notify * colors_notify
Notifications: ColorId, EventColor.
Definition module_data.h:40
An Event that happened to a Colour.
Definition notify2.h:52
+ 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 86 of file color.c.

87{
93}
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:99
void simple_colors_cleanup(void)
Cleanup the simple colour definitions.
Definition simple.c:85
void merged_colors_cleanup(void)
Free the list of Merged colours.
Definition merged.c:53
void quoted_colors_cleanup(void)
Cleanup the quoted-email colours.
Definition quoted.c:90
+ 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 100 of file color.c.

101{
102 return (cid == MT_COLOR_ATTACH_HEADERS) || (cid == MT_COLOR_BODY) ||
103 (cid == MT_COLOR_HEADER) || (cid == MT_COLOR_INDEX) ||
104 (cid == MT_COLOR_INDEX_AUTHOR) || (cid == MT_COLOR_INDEX_COLLAPSED) ||
105 (cid == MT_COLOR_INDEX_DATE) || (cid == MT_COLOR_INDEX_FLAGS) ||
106 (cid == MT_COLOR_INDEX_LABEL) || (cid == MT_COLOR_INDEX_NUMBER) ||
107 (cid == MT_COLOR_INDEX_SIZE) || (cid == MT_COLOR_INDEX_SUBJECT) ||
108 (cid == MT_COLOR_INDEX_TAG) || (cid == MT_COLOR_INDEX_TAGS) ||
109 (cid == MT_COLOR_STATUS);
110}
@ MT_COLOR_INDEX_AUTHOR
Index: author field.
Definition color.h:87
@ MT_COLOR_HEADER
Message headers (takes a pattern)
Definition color.h:48
@ MT_COLOR_STATUS
Status bar (takes a pattern)
Definition color.h:78
@ MT_COLOR_INDEX_SIZE
Index: size field.
Definition color.h:93
@ MT_COLOR_INDEX_TAGS
Index: tags field (g, J)
Definition color.h:96
@ MT_COLOR_INDEX_SUBJECT
Index: subject field.
Definition color.h:94
@ MT_COLOR_BODY
Pager: highlight body of message (takes a pattern)
Definition color.h:39
@ MT_COLOR_INDEX_DATE
Index: date field.
Definition color.h:89
@ MT_COLOR_INDEX_TAG
Index: tag field (G)
Definition color.h:95
@ MT_COLOR_ATTACH_HEADERS
MIME attachment test (takes a pattern)
Definition color.h:38
@ MT_COLOR_INDEX_LABEL
Index: label field.
Definition color.h:91
@ MT_COLOR_INDEX
Index: default colour.
Definition color.h:86
@ MT_COLOR_INDEX_NUMBER
Index: index number.
Definition color.h:92
@ MT_COLOR_INDEX_FLAGS
Index: flags field.
Definition color.h:90
@ MT_COLOR_INDEX_COLLAPSED
Index: number of messages in collapsed thread.
Definition color.h:88
+ Here is the caller graph for this function: