return (COLOR_PAIR(p->index));
}
+static int mutt_lookup_color(short pair, short *fg, short *bg)
+{
+ struct ColorList *p = ColorList;
+
+ while (p)
+ {
+ if (COLOR_PAIR(p->index) == pair)
+ {
+ if (fg)
+ *fg = p->fg;
+ if (bg)
+ *bg = p->bg;
+ return 0;
+ }
+ p = p->next;
+ }
+ return -1;
+}
+
+int mutt_combine_color(int fg_attr, int bg_attr)
+{
+ short fg, bg;
+
+ fg = bg = COLOR_DEFAULT;
+ mutt_lookup_color(fg_attr, &fg, NULL);
+ mutt_lookup_color(bg_attr, NULL, &bg);
+ if ((fg == COLOR_DEFAULT) && (bg == COLOR_DEFAULT))
+ return A_NORMAL;
+#ifdef HAVE_USE_DEFAULT_COLORS
+ if (!option(OPTNOCURSES) && has_colors() &&
+ ((fg == COLOR_DEFAULT) || (bg == COLOR_DEFAULT)) && use_default_colors() != OK)
+ {
+ mutt_error(_("default colors not supported."));
+ return A_NORMAL;
+ }
+#endif
+ return mutt_alloc_color(fg, bg);
+}
+
void mutt_free_color(int fg, int bg)
{
struct ColorList *p = NULL, *q = NULL;
if (*s < MUTT_TREE_MAX)
{
if (do_color)
+#if defined(HAVE_COLOR) && defined(HAVE_USE_DEFAULT_COLORS)
+ /* Combining tree fg color and another bg color requires
+ * having use_default_colors, because the other bg color
+ * may be undefined. */
+ ATTRSET(mutt_combine_color(ColorDefs[MT_COLOR_TREE], attr));
+#else
SETCOLOR(MT_COLOR_TREE);
+#endif
+
while (*s && *s < MUTT_TREE_MAX)
{
switch (*s)
void mutt_alias_add_reverse(struct Alias *t);
void mutt_alias_delete_reverse(struct Alias *t);
int mutt_alloc_color(int fg, int bg);
+int mutt_combine_color(int fg_attr, int bg_attr);
int mutt_any_key_to_continue(const char *s);
char *mutt_apply_replace(char *dbuf, size_t dlen, char *sbuf, struct ReplaceList *rlist);
int mutt_buffy_check(bool force);