Parse colours. More...
#include "config.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include "mutt/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "parse_color.h"
#include "parse/lib.h"
#include "attr.h"
#include "color.h"
#include "debug.h"
Go to the source code of this file.
Functions | |
int | parse_color_prefix (const char *s, enum ColorPrefix *prefix) |
Parse a colour prefix, e.g. | |
enum CommandResult | parse_color_namedcolor (const char *s, struct ColorElement *elem, struct Buffer *err) |
Parse a named colour, e.g. | |
enum CommandResult | parse_color_colornnn (const char *s, struct ColorElement *elem, struct Buffer *err) |
Parse a colorNNN, e.g. | |
enum CommandResult | parse_color_rrggbb (const char *s, struct ColorElement *elem, struct Buffer *err) |
Parse an RGB colour, e.g. | |
enum CommandResult | parse_color_name (const char *s, struct ColorElement *elem, struct Buffer *err) |
Parse a colour name. | |
enum CommandResult | parse_color_pair (struct Buffer *buf, struct Buffer *s, struct AttrColor *ac, struct Buffer *err) |
Parse a pair of colours - Implements parser_callback_t -. | |
enum CommandResult | parse_attr_spec (struct Buffer *buf, struct Buffer *s, struct AttrColor *ac, struct Buffer *err) |
Parse an attribute description - Implements parser_callback_t -. | |
Variables | |
const struct Mapping | ColorNames [] |
Mapping between a colour name and an ncurses colour. | |
static struct Mapping | AttributeNames [] |
Mapping of attribute names to their IDs. | |
Parse colours.
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 parse_color.c.
int parse_color_prefix | ( | const char * | s, |
enum ColorPrefix * | prefix | ||
) |
Parse a colour prefix, e.g.
"bright"
[in] | s | String to parse |
[out] | prefix | parsed prefix, see ColorPrefix |
num | Length of the matched prefix |
0 | No prefix matched |
If prefixes should be parsed, but their value is irrelevant, NULL can be passed as 'prefix'.
Definition at line 82 of file parse_color.c.
enum CommandResult parse_color_namedcolor | ( | const char * | s, |
struct ColorElement * | elem, | ||
struct Buffer * | err | ||
) |
Parse a named colour, e.g.
"brightred"
[in] | s | String to parse |
[out] | elem | Colour element to update |
[out] | err | Buffer for error messages |
MUTT_CMD_SUCCESS | Colour parsed successfully |
MUTT_CMD_WARNING | Unknown colour, try other parsers |
Definition at line 119 of file parse_color.c.
enum CommandResult parse_color_colornnn | ( | const char * | s, |
struct ColorElement * | elem, | ||
struct Buffer * | err | ||
) |
Parse a colorNNN, e.g.
"color123"
[in] | s | String to parse |
[out] | elem | Colour element to update |
[out] | err | Buffer for error messages |
MUTT_CMD_SUCCESS | Colour parsed successfully |
MUTT_CMD_WARNING | Unknown colour, try other parsers |
MUTT_CMD_ERROR | Error, colour could not be parsed |
On MUTT_CMD_ERROR, an error message will be written to err.
Definition at line 163 of file parse_color.c.
enum CommandResult parse_color_rrggbb | ( | const char * | s, |
struct ColorElement * | elem, | ||
struct Buffer * | err | ||
) |
Parse an RGB colour, e.g.
"#12FE45"
[in] | s | String to parse |
[out] | elem | Colour element to update |
[out] | err | Buffer for error messages |
MUTT_CMD_SUCCESS | Colour parsed successfully |
MUTT_CMD_WARNING | Unknown colour, try other parsers |
MUTT_CMD_ERROR | Error, colour could not be parsed |
On MUTT_CMD_ERROR, an error message will be written to err.
Definition at line 211 of file parse_color.c.
enum CommandResult parse_color_name | ( | const char * | s, |
struct ColorElement * | elem, | ||
struct Buffer * | err | ||
) |
Parse a colour name.
[in] | s | String to parse |
[out] | elem | Colour element to update |
[out] | err | Buffer for error messages |
CommandResult | Result e.g. MUTT_CMD_SUCCESS |
Parse a colour name, such as "red", "brightgreen", "color123", "#12FE45"
Definition at line 248 of file parse_color.c.
const struct Mapping ColorNames[] |
Mapping between a colour name and an ncurses colour.
Definition at line 41 of file parse_color.c.
|
static |
Mapping of attribute names to their IDs.
Definition at line 59 of file parse_color.c.