NeoMutt  2021-10-29-220-g2b1eec
Teaching an old dog new tricks
DOXYGEN
simple.c
Go to the documentation of this file.
1 
30 #include "config.h"
31 #include <stddef.h>
32 #include <stdbool.h>
33 #include "mutt/lib.h"
34 #include "gui/lib.h"
35 
37 
42 {
43  memset(SimpleColors, A_NORMAL, MT_COLOR_MAX * sizeof(int));
44 
45  // Set some defaults
46  SimpleColors[MT_COLOR_INDICATOR] = A_REVERSE;
47  SimpleColors[MT_COLOR_MARKERS] = A_REVERSE;
48  SimpleColors[MT_COLOR_SEARCH] = A_REVERSE;
49 #ifdef USE_SIDEBAR
51 #endif
52  SimpleColors[MT_COLOR_STATUS] = A_REVERSE;
53 }
54 
59 {
60  memset(SimpleColors, A_NORMAL, MT_COLOR_MAX * sizeof(int));
61 }
62 
69 {
70  if (cid >= MT_COLOR_MAX)
71  {
72  mutt_error("colour overflow %d", cid);
73  return 0;
74  }
75  if (cid <= MT_COLOR_NONE)
76  {
77  mutt_error("colour underflow %d", cid);
78  return 0;
79  }
80 
81  return SimpleColors[cid];
82 }
83 
90 {
91  int color = simple_color_get(cid);
92 
93  return (color > 0);
94 }
95 
102 {
103  return (cid == MT_COLOR_HEADER) || (cid == MT_COLOR_HDRDEFAULT);
104 }
void simple_colors_init(void)
Initialise the simple colour definitions.
Definition: simple.c:41
bool simple_color_is_header(enum ColorId cid)
Colour is for an Email header.
Definition: simple.c:101
void simple_colors_clear(void)
Reset the simple colour definitions.
Definition: simple.c:58
int simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
Definition: simple.c:68
int SimpleColors[MT_COLOR_MAX]
Array of all fixed colours, see enum ColorId.
Definition: simple.c:36
bool simple_color_is_set(enum ColorId cid)
Is the object coloured?
Definition: simple.c:89
ColorId
List of all colored objects.
Definition: color.h:35
@ MT_COLOR_MARKERS
Pager: markers, line continuation.
Definition: color.h:50
@ MT_COLOR_MAX
Definition: color.h:88
@ MT_COLOR_HEADER
Message headers (takes a pattern)
Definition: color.h:48
@ MT_COLOR_STATUS
Status bar (takes a pattern)
Definition: color.h:70
@ MT_COLOR_INDICATOR
Selected item in list.
Definition: color.h:49
@ MT_COLOR_NONE
Definition: color.h:36
@ MT_COLOR_HDRDEFAULT
Header default colour.
Definition: color.h:47
@ MT_COLOR_SEARCH
Pager: search matches.
Definition: color.h:58
@ MT_COLOR_SIDEBAR_HIGHLIGHT
Select cursor.
Definition: color.h:62
#define mutt_error(...)
Definition: logging.h:87
Convenience wrapper for the gui headers.
Convenience wrapper for the library headers.