NeoMutt  2021-10-29-220-g2b1eec
Teaching an old dog new tricks
DOXYGEN
simple.c File Reference

Simple colour. More...

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

Go to the source code of this file.

Functions

void simple_colors_init (void)
 Initialise the simple colour definitions. More...
 
void simple_colors_clear (void)
 Reset the simple colour definitions. More...
 
int simple_color_get (enum ColorId cid)
 Get the colour of an object by its ID. More...
 
bool simple_color_is_set (enum ColorId cid)
 Is the object coloured? More...
 
bool simple_color_is_header (enum ColorId cid)
 Colour is for an Email header. More...
 

Variables

int SimpleColors [MT_COLOR_MAX]
 Array of all fixed colours, see enum ColorId. More...
 

Detailed Description

Simple colour.

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

Function Documentation

◆ simple_colors_init()

void simple_colors_init ( void  )

Initialise the simple colour definitions.

Definition at line 41 of file simple.c.

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 }
int SimpleColors[MT_COLOR_MAX]
Array of all fixed colours, see enum ColorId.
Definition: simple.c:36
@ MT_COLOR_MARKERS
Pager: markers, line continuation.
Definition: color.h:50
@ MT_COLOR_MAX
Definition: color.h:88
@ 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_SEARCH
Pager: search matches.
Definition: color.h:58
@ MT_COLOR_SIDEBAR_HIGHLIGHT
Select cursor.
Definition: color.h:62
+ Here is the caller graph for this function:

◆ simple_colors_clear()

void simple_colors_clear ( void  )

Reset the simple colour definitions.

Definition at line 58 of file simple.c.

59 {
60  memset(SimpleColors, A_NORMAL, MT_COLOR_MAX * sizeof(int));
61 }
+ Here is the caller graph for this function:

◆ simple_color_get()

int simple_color_get ( enum ColorId  cid)

Get the colour of an object by its ID.

Parameters
cidColour Id, e.g. MT_COLOR_SEARCH
Return values
numColor of the object

Definition at line 68 of file simple.c.

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 }
@ MT_COLOR_NONE
Definition: color.h:36
#define mutt_error(...)
Definition: logging.h:87
+ Here is the caller graph for this function:

◆ simple_color_is_set()

bool simple_color_is_set ( enum ColorId  cid)

Is the object coloured?

Parameters
cidColour Id, e.g. MT_COLOR_SEARCH
Return values
trueYes, a 'color' command has been used on this object

Definition at line 89 of file simple.c.

90 {
91  int color = simple_color_get(cid);
92 
93  return (color > 0);
94 }
int simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
Definition: simple.c:68
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ simple_color_is_header()

bool simple_color_is_header ( enum ColorId  cid)

Colour is for an Email header.

Parameters
cidColour Id, e.g. MT_COLOR_HEADER
Return values
trueColour is for an Email header

Definition at line 101 of file simple.c.

102 {
103  return (cid == MT_COLOR_HEADER) || (cid == MT_COLOR_HDRDEFAULT);
104 }
@ MT_COLOR_HEADER
Message headers (takes a pattern)
Definition: color.h:48
@ MT_COLOR_HDRDEFAULT
Header default colour.
Definition: color.h:47
+ Here is the caller graph for this function:

Variable Documentation

◆ SimpleColors

int SimpleColors[MT_COLOR_MAX]

Array of all fixed colours, see enum ColorId.

Definition at line 36 of file simple.c.