Skip to content

Commit

Permalink
ChafaTermDb: Eat advertises color support via TERM
Browse files Browse the repository at this point in the history
The Eat terminal advertises its color support by setting its TERM to:
* eat-truecolor when it supports more than 256 colors,
* eat-256color when it supports more than 16 colors,
* eat-16color when it supports more than 8 colors,
* eat-color when it supports more than 1 color,
* eat-mono when it supports no colors.

Note that eat-16color isn't actually supported yet, but a bug has been
filed upstream: https://codeberg.org/akib/emacs-eat/issues/154
  • Loading branch information
sfllaw committed Apr 18, 2024
1 parent c12ef2c commit 6824130
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions chafa/chafa-term-db.c
Expand Up @@ -267,6 +267,17 @@ static const SeqStr *color_16_list [] =
NULL
};

static const SeqStr *color_8_list [] =
{
color_8_seqs,
NULL
};

static const SeqStr *color_mono_list [] =
{
NULL
};

static const SeqStr color_fbterm_seqs [] =
{
{ CHAFA_TERM_SEQ_SET_COLOR_FG_16, "\033[1;%1}" },
Expand Down Expand Up @@ -544,6 +555,18 @@ detect_capabilities (ChafaTermInfo *ti, gchar **envp)
if (!strcmp (term, "rxvt-unicode"))
color_seq_list = color_16_list;

/* Eat uses the "eat-" prefix for TERM. */
if (!strcmp (term, "eat-truecolor"))
color_seq_list = color_direct_list;
if (!strcmp (term, "eat-256color"))
color_seq_list = color_256_list;
if (!strcmp (term, "eat-16color"))
color_seq_list = color_16_list;
if (!strcmp (term, "eat-color"))
color_seq_list = color_8_list;
if (!strcmp (term, "eat-mono"))
color_seq_list = color_mono_list;

/* 'screen' does not like truecolor at all, but 256 colors works fine.
* Sometimes we'll see the outer terminal appended to the TERM string,
* like so: screen.xterm-256color */
Expand Down

0 comments on commit 6824130

Please sign in to comment.