Prototype for a function to parse color config.
More...
|
static enum CommandResult | parse_attr_spec (struct Buffer *buf, struct Buffer *s, uint32_t *fg, uint32_t *bg, int *attrs, struct Buffer *err) |
| Parse an attribute description - Implements parser_callback_t -.
|
|
static enum CommandResult | parse_color_pair (struct Buffer *buf, struct Buffer *s, uint32_t *fg, uint32_t *bg, int *attrs, struct Buffer *err) |
| Parse a pair of colours - Implements parser_callback_t -.
|
|
Prototype for a function to parse color config.
- Parameters
-
[in] | buf | Temporary Buffer space |
[in] | s | Buffer containing string to be parsed |
[out] | fg | Foreground colour (set to -1) |
[out] | bg | Background colour (set to -1) |
[out] | attrs | Attributes, e.g. A_UNDERLINE |
[out] | err | Buffer for error messages |
- Return values
-
◆ parse_attr_spec()
Parse an attribute description - Implements parser_callback_t -.
Definition at line 544 of file command.c.
547{
548 if (fg)
550 if (bg)
552
554 {
555 buf_printf(err,
_(
"%s: too few arguments"),
"mono");
557 }
558
560
562 {
563 *attrs |= A_BOLD;
564 }
566 {
567 *attrs |= A_ITALIC;
568 }
570 {
571 *attrs = A_NORMAL;
572 }
574 {
575 *attrs = A_NORMAL;
576 }
578 {
579 *attrs |= A_REVERSE;
580 }
582 {
583 *attrs |= A_STANDOUT;
584 }
586 {
587 *attrs |= A_UNDERLINE;
588 }
589 else
590 {
593 }
594
596}
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
@ MUTT_CMD_SUCCESS
Success: Command worked.
@ MUTT_CMD_WARNING
Warning: Help given to the user.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
char * data
Pointer to data.
◆ parse_color_pair()
Parse a pair of colours - Implements parser_callback_t -.
Parse a pair of colours, e.g. "red default"
Definition at line 603 of file command.c.
606{
607 while (true)
608 {
610 {
611 buf_printf(err,
_(
"%s: too few arguments"),
"color");
613 }
614
616
618 {
619 *attrs |= A_BOLD;
621 }
623 {
624 *attrs |= A_ITALIC;
626 }
628 {
629 *attrs = A_NORMAL;
631 }
633 {
634 *attrs = A_NORMAL;
636 }
638 {
639 *attrs |= A_REVERSE;
641 }
643 {
644 *attrs |= A_STANDOUT;
646 }
648 {
649 *attrs |= A_UNDERLINE;
651 }
652 else
653 {
656 return rc;
657 break;
658 }
659 }
660
662 {
663 buf_printf(err,
_(
"%s: too few arguments"),
"color");
665 }
666
668
670}
static enum CommandResult parse_color_name(const char *s, uint32_t *col, int *attrs, bool is_fg, struct Buffer *err)
Parse a colour name.
CommandResult
Error codes for command_t parse functions.
int color_debug(enum LogLevel level, const char *format,...)
Write to the log file.
@ LL_DEBUG5
Log at debug level 5.