[ansi-print] Fix unicolor detection

This commit is contained in:
Behdad Esfahbod 2022-06-22 16:17:49 -06:00
parent a4db80ca0a
commit 2ebaf0c5ba
1 changed files with 3 additions and 3 deletions

View File

@ -175,9 +175,9 @@ struct biimage_t
for (unsigned int i = 1; i < 8; i++)
if (freq[bg] < freq[i])
bg = i;
fg = 0;
for (unsigned int i = 1; i < 8; i++)
if (i != bg && freq[fg] < freq[i])
fg = 8;
for (unsigned int i = 0; i < 8; i++)
if (i != bg && (fg == 8 || freq[fg] < freq[i]))
fg = i;
if (fg == bg || freq[fg] == 0) {
fg = bg;