NeoMutt  2025-12-11-911-gd8d604
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
module.c File Reference

Definition of the Color Module. More...

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

Go to the source code of this file.

Functions

static bool color_init (struct NeoMutt *n)
 Initialise a Module - Implements Module::init()
 
static bool color_config_define_variables (struct NeoMutt *n, struct ConfigSet *cs)
 Define the Config Variables - Implements Module::config_define_variables()
 
static bool color_commands_register (struct NeoMutt *n, struct CommandArray *ca)
 Register NeoMutt Commands - Implements Module::commands_register()
 
static bool color_gui_init (struct NeoMutt *n)
 Initialise the GUI - Implements Module::gui_init()
 
static void color_gui_cleanup (struct NeoMutt *n)
 Clean up the GUI - Implements Module::gui_cleanup()
 
static bool color_cleanup (struct NeoMutt *n, void *data)
 Clean up a Module - Implements Module::cleanup()
 

Variables

const struct Command ColorCommands []
 Colour Commands.
 
struct ConfigDef ColorVars []
 Config definitions for the Color module.
 
const struct Module ModuleColor
 Module for the Color library.
 

Detailed Description

Definition of the Color Module.

Authors
  • Richard Russon

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

Function Documentation

◆ color_init()

static bool color_init ( struct NeoMutt * n)
static

Initialise a Module - Implements Module::init()

Definition at line 44 of file module.c.

45{
46 struct ColorModuleData *mod_data = MUTT_MEM_CALLOC(1, struct ColorModuleData);
48
49 mod_data->notify = notify_new();
50 notify_set_parent(mod_data->notify, n->notify);
51
52 return true;
53}
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
@ MODULE_ID_COLOR
ModuleColor, Color
Definition module_api.h:53
struct Notify * notify_new(void)
Create a new notifications handler.
Definition notify.c:62
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
Definition notify.c:95
void neomutt_set_module_data(struct NeoMutt *n, enum ModuleId id, void *data)
Set the private data for a Module.
Definition neomutt.c:677
Color private Module data.
Definition module_data.h:35
struct Notify * notify
Notifications.
Definition module_data.h:36
struct Notify * notify
Notifications handler.
Definition neomutt.h:45
+ Here is the call graph for this function:

◆ color_config_define_variables()

static bool color_config_define_variables ( struct NeoMutt * n,
struct ConfigSet * cs )
static

Define the Config Variables - Implements Module::config_define_variables()

Definition at line 58 of file module.c.

59{
61}
struct ConfigDef ColorVars[]
Config definitions for the Color module.
Definition config.c:37
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[])
Register a set of config items.
Definition set.c:290
+ Here is the call graph for this function:

◆ color_commands_register()

static bool color_commands_register ( struct NeoMutt * n,
struct CommandArray * ca )
static

Register NeoMutt Commands - Implements Module::commands_register()

Definition at line 66 of file module.c.

67{
69}
const struct Command ColorCommands[]
Colour Commands.
Definition commands.c:571
bool commands_register(struct CommandArray *ca, const struct Command *cmds)
Add commands to Commands array.
Definition command.c:51
+ Here is the call graph for this function:

◆ color_gui_init()

static bool color_gui_init ( struct NeoMutt * n)
static

Initialise the GUI - Implements Module::gui_init()

Definition at line 74 of file module.c.

75{
76 return true;
77}

◆ color_gui_cleanup()

static void color_gui_cleanup ( struct NeoMutt * n)
static

Clean up the GUI - Implements Module::gui_cleanup()

Definition at line 82 of file module.c.

83{
85 colors_cleanup(mod_data);
86}
void colors_cleanup(struct ColorModuleData *mod_data)
Cleanup all the colours.
Definition color.c:88
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:663
+ Here is the call graph for this function:

◆ color_cleanup()

static bool color_cleanup ( struct NeoMutt * n,
void * data )
static

Clean up a Module - Implements Module::cleanup()

Definition at line 91 of file module.c.

92{
93 struct ColorModuleData *mod_data = data;
94
95 notify_free(&mod_data->notify);
96
97 FREE(&mod_data);
98 return true;
99}
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
void notify_free(struct Notify **ptr)
Free a notification handler.
Definition notify.c:75
+ Here is the call graph for this function:

Variable Documentation

◆ ColorCommands

const struct Command ColorCommands[]
extern

Colour Commands.

Definition at line 571 of file commands.c.

571 {
572 // clang-format off
573 { "color", CMD_COLOR, parse_color,
574 N_("Define colors for the user interface"),
575 N_("color <object> [ <attribute> ... ] <fg> <bg> [ <regex> [ <num> ]]"),
576 "configuration.html#color" },
577 { "mono", CMD_MONO, parse_mono,
578 N_("Deprecated: Use `color` instead"),
579 N_("mono <object> <attribute> [ <pattern> | <regex> ]"),
580 "configuration.html#color-mono" },
581 { "uncolor", CMD_UNCOLOR, parse_uncolor,
582 N_("Remove a `color` definition"),
583 N_("uncolor <object> { * | <pattern> ... }"),
584 "configuration.html#color" },
585 { "unmono", CMD_UNMONO, parse_unmono,
586 N_("Deprecated: Use `uncolor` instead"),
587 N_("unmono <object> { * | <pattern> ... }"),
588 "configuration.html#color-mono" },
589
590 { NULL, CMD_NONE, NULL, NULL, NULL, NULL, CF_NONE },
591 // clang-format on
592};
@ CF_NONE
No flags are set.
Definition command.h:49
@ CMD_UNCOLOR
:uncolor
Definition command.h:132
@ CMD_COLOR
:color
Definition command.h:74
@ CMD_NONE
No Command.
Definition command.h:62
@ CMD_MONO
:mono
Definition command.h:99
@ CMD_UNMONO
:unmono
Definition command.h:142
enum CommandResult parse_uncolor(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'uncolor' command - Implements Command::parse() -.
Definition commands.c:448
enum CommandResult parse_unmono(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'unmono' command - Implements Command::parse() -.
Definition commands.c:486
enum CommandResult parse_mono(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'mono' command - Implements Command::parse() -.
Definition commands.c:541
enum CommandResult parse_color(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'color' command - Implements Command::parse() -.
Definition commands.c:508
#define N_(a)
Definition message.h:32

◆ ColorVars

struct ConfigDef ColorVars[]
extern

Config definitions for the Color module.

Definition at line 37 of file config.c.

37 {
38 // clang-format off
39 { "color_directcolor", DT_BOOL|D_ON_STARTUP, false, 0, NULL,
40 "Use 24bit colors (aka truecolor aka directcolor)"
41 },
42
43 { NULL },
44 // clang-format on
45};
@ DT_BOOL
boolean option
Definition types.h:32
#define D_ON_STARTUP
May only be set at startup.
Definition types.h:79

◆ ModuleColor

const struct Module ModuleColor
Initial value:
= {
"color",
NULL,
}
static bool color_gui_init(struct NeoMutt *n)
Initialise the GUI - Implements Module::gui_init()
Definition module.c:74
static bool color_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:44
static bool color_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
Define the Config Variables - Implements Module::config_define_variables()
Definition module.c:58
static bool color_cleanup(struct NeoMutt *n, void *data)
Clean up a Module - Implements Module::cleanup()
Definition module.c:91
static bool color_commands_register(struct NeoMutt *n, struct CommandArray *ca)
Register NeoMutt Commands - Implements Module::commands_register()
Definition module.c:66
static void color_gui_cleanup(struct NeoMutt *n)
Clean up the GUI - Implements Module::gui_cleanup()
Definition module.c:82

Module for the Color library.

Definition at line 104 of file module.c.

104 {
106 "color",
108 NULL, // config_define_types
114};