Support 16-color set (per Anders Kaseorg).

Closes #106 github issue.
Closes #133 github issue.
Closes #131 github issue.
This commit is contained in:
Keith Winstein
2012-04-11 03:09:26 -04:00
parent 774e50dc19
commit a67ae7b0f4
+7 -1
View File
@@ -380,7 +380,7 @@ Renditions::Renditions( int s_background )
background_color( 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 ) void Renditions::set_rendition( int num )
{ {
if ( num == 0 ) { 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 */ } else if ( (40 <= num) && (num <= 47) ) { /* background color in 8-color set */
background_color = num; background_color = num;
return; 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 ) { switch ( num ) {