From a67ae7b0f4024290d29a9d616b86e71b6918fde4 Mon Sep 17 00:00:00 2001 From: Keith Winstein Date: Wed, 11 Apr 2012 03:09:26 -0400 Subject: [PATCH] Support 16-color set (per Anders Kaseorg). Closes #106 github issue. Closes #133 github issue. Closes #131 github issue. --- src/terminal/terminalframebuffer.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/terminal/terminalframebuffer.cc b/src/terminal/terminalframebuffer.cc index c38603d..943d07e 100644 --- a/src/terminal/terminalframebuffer.cc +++ b/src/terminal/terminalframebuffer.cc @@ -380,7 +380,7 @@ Renditions::Renditions( int s_background ) background_color( s_background ) {} -/* This routine cannot be used to set a color beyond the 8-color set. */ +/* This routine cannot be used to set a color beyond the 16-color set. */ void Renditions::set_rendition( int num ) { if ( num == 0 ) { @@ -403,6 +403,12 @@ void Renditions::set_rendition( int num ) } else if ( (40 <= num) && (num <= 47) ) { /* background color in 8-color set */ background_color = num; return; + } else if ( (90 <= num) && (num <= 97) ) { /* foreground color in 16-color set */ + foreground_color = num - 90 + 38; + return; + } else if ( (100 <= num) && (num <= 107) ) { /* background color in 16-color set */ + background_color = num - 100 + 48; + return; } switch ( num ) {