NeoMutt
2025-12-11-1039-g550ac6
Teaching an old dog new tricks
DOXYGEN
Toggle main menu visibility
Loading...
Searching...
No Matches
attr.h
Go to the documentation of this file.
1
22
23
#ifndef MUTT_COLOR_ATTR_H
24
#define MUTT_COLOR_ATTR_H
25
26
#include <stdbool.h>
27
#include "
mutt/lib.h
"
28
#include "
curses2.h
"
29
33
enum
ColorType
34
{
35
CT_SIMPLE
,
36
CT_PALETTE
,
37
CT_RGB
,
38
};
39
43
enum
ColorPrefix
44
{
45
COLOR_PREFIX_NONE
,
46
COLOR_PREFIX_ALERT
,
47
COLOR_PREFIX_BRIGHT
,
48
COLOR_PREFIX_LIGHT
,
49
};
50
54
struct
ColorElement
55
{
56
color_t
color
;
57
enum
ColorType
type
;
58
enum
ColorPrefix
prefix
;
59
};
60
64
struct
AttrColor
65
{
66
struct
ColorElement
fg
;
67
struct
ColorElement
bg
;
68
int
attrs
;
69
struct
CursesColor
*
curses_color
;
70
short
ref_count
;
71
TAILQ_ENTRY
(
AttrColor
) entries;
72
};
73
TAILQ_HEAD
(AttrColorList,
AttrColor
);
74
75
void
attr_color_clear
(
struct
AttrColor
*ac);
76
struct
AttrColor
attr_color_copy
(const struct
AttrColor
*ac);
77
void
attr_color_free
(
struct
AttrColor
**ptr);
78
bool
attr_color_is_set
(
const
struct
AttrColor
*ac);
79
bool
attr_color_match
(
struct
AttrColor
*ac1,
struct
AttrColor
*ac2);
80
struct
AttrColor
*
attr_color_new
(
void
);
81
82
void
attr_color_list_clear
(
struct
AttrColorList *acl);
83
struct
AttrColor
*
attr_color_list_find
(
struct
AttrColorList *acl,
color_t
fg
,
color_t
bg
,
int
attrs
);
84
85
void
attr_color_overwrite
(
struct
AttrColor
*ac_old,
const
struct
AttrColor
*ac_new);
86
87
#endif
/* MUTT_COLOR_ATTR_H */
attr_color_copy
struct AttrColor attr_color_copy(const struct AttrColor *ac)
Copy a colour.
Definition
attr.c:165
attr_color_list_find
struct AttrColor * attr_color_list_find(struct AttrColorList *acl, color_t fg, color_t bg, int attrs)
Find an AttrColor in a list.
Definition
attr.c:138
attr_color_clear
void attr_color_clear(struct AttrColor *ac)
Free the contents of an AttrColor.
Definition
attr.c:47
ColorPrefix
ColorPrefix
Constants for colour prefixes of named colours.
Definition
attr.h:44
COLOR_PREFIX_NONE
@ COLOR_PREFIX_NONE
no prefix
Definition
attr.h:45
COLOR_PREFIX_ALERT
@ COLOR_PREFIX_ALERT
"alert" colour prefix
Definition
attr.h:46
COLOR_PREFIX_LIGHT
@ COLOR_PREFIX_LIGHT
"light" colour prefix
Definition
attr.h:48
COLOR_PREFIX_BRIGHT
@ COLOR_PREFIX_BRIGHT
"bright" colour prefix
Definition
attr.h:47
ColorType
ColorType
Type of Colour.
Definition
attr.h:34
CT_SIMPLE
@ CT_SIMPLE
Simple colour, e.g. "Red".
Definition
attr.h:35
CT_PALETTE
@ CT_PALETTE
Palette colour, e.g. "color207".
Definition
attr.h:36
CT_RGB
@ CT_RGB
True colour, e.g. "#11AAFF".
Definition
attr.h:37
attr_color_overwrite
void attr_color_overwrite(struct AttrColor *ac_old, const struct AttrColor *ac_new)
Update an AttrColor in-place.
Definition
attr.c:394
attr_color_match
bool attr_color_match(struct AttrColor *ac1, struct AttrColor *ac2)
Do the colours match?
Definition
attr.c:192
attr_color_new
struct AttrColor * attr_color_new(void)
Create a new AttrColor.
Definition
attr.c:89
attr_color_free
void attr_color_free(struct AttrColor **ptr)
Free an AttrColor.
Definition
attr.c:68
attr_color_list_clear
void attr_color_list_clear(struct AttrColorList *acl)
Free the contents of an AttrColorList.
Definition
attr.c:116
attr_color_is_set
bool attr_color_is_set(const struct AttrColor *ac)
Is the object coloured?
Definition
attr.c:178
curses2.h
Curses Colour.
color_t
int32_t color_t
Type for 24-bit colour value.
Definition
curses2.h:30
lib.h
Convenience wrapper for the library headers.
TAILQ_HEAD
#define TAILQ_HEAD(name, type)
Definition
queue.h:680
AttrColor
A curses colour and its attributes.
Definition
attr.h:65
AttrColor::bg
struct ColorElement bg
Background colour.
Definition
attr.h:67
AttrColor::fg
struct ColorElement fg
Foreground colour.
Definition
attr.h:66
AttrColor::TAILQ_ENTRY
TAILQ_ENTRY(AttrColor) entries
Linked list.
AttrColor::ref_count
short ref_count
Number of users.
Definition
attr.h:70
AttrColor::attrs
int attrs
Text attributes, e.g. A_BOLD.
Definition
attr.h:68
AttrColor::curses_color
struct CursesColor * curses_color
Underlying Curses colour.
Definition
attr.h:69
ColorElement
One element of a Colour.
Definition
attr.h:55
ColorElement::type
enum ColorType type
Type of Colour.
Definition
attr.h:57
ColorElement::color
color_t color
Colour.
Definition
attr.h:56
ColorElement::prefix
enum ColorPrefix prefix
Optional Colour Modifier.
Definition
attr.h:58
CursesColor
Colour in the ncurses palette.
Definition
curses2.h:40