diff options
author | ed <ed@FreeBSD.org> | 2009-09-26 15:26:32 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-09-26 15:26:32 +0000 |
commit | b69a48a63f54bfcc1c9b1bf8a8828fbaf25e004b (patch) | |
tree | 33e925a77e9fa035d0525a951f7a87e23f46271e /sys/teken/teken_subr_compat.h | |
parent | ba94d1a005032941ea59b2f361257e1cbd4fa6bd (diff) | |
download | FreeBSD-src-b69a48a63f54bfcc1c9b1bf8a8828fbaf25e004b.zip FreeBSD-src-b69a48a63f54bfcc1c9b1bf8a8828fbaf25e004b.tar.gz |
Add 256 color support.
It is quite inconvenient that if an application for xterm uses 256 color
mode, text suddenly starts to blink (because of ;5; in the middle).
We'd better just implement 256 color mode and add a conversion routine
from 256 to 8 color mode, which doesn't seem to be too bad in practice.
Remapping colors is done quite simple. If one of the channels is most
actively represented, primary colors are used. If two channels are most
actively represented, secondary colors are used. If all three channels
are equal (gray), it picks between black and white.
Reported by: Paul B. Mahol <onemda gmail com>
Diffstat (limited to 'sys/teken/teken_subr_compat.h')
-rw-r--r-- | sys/teken/teken_subr_compat.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/teken/teken_subr_compat.h b/sys/teken/teken_subr_compat.h index 088f378..e937298 100644 --- a/sys/teken/teken_subr_compat.h +++ b/sys/teken/teken_subr_compat.h @@ -65,10 +65,10 @@ void teken_get_defattr_cons25(teken_t *t, int *fg, int *bg) { - *fg = cons25_revcolors[t->t_defattr.ta_fgcolor]; + *fg = cons25_revcolors[teken_256to8(t->t_defattr.ta_fgcolor)]; if (t->t_defattr.ta_format & TF_BOLD) *fg += 8; - *bg = cons25_revcolors[t->t_defattr.ta_bgcolor]; + *bg = cons25_revcolors[teken_256to8(t->t_defattr.ta_bgcolor)]; } static void |