SOURCES: fbterm-256_colors.patch (NEW) - added support for 256 colors

witekfl witekfl at pld-linux.org
Tue Dec 16 15:15:58 CET 2008


Author: witekfl                      Date: Tue Dec 16 14:15:58 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- added support for 256 colors

---- Files affected:
SOURCES:
   fbterm-256_colors.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/fbterm-256_colors.patch
diff -u /dev/null SOURCES/fbterm-256_colors.patch:1.1
--- /dev/null	Tue Dec 16 15:15:58 2008
+++ SOURCES/fbterm-256_colors.patch	Tue Dec 16 15:15:52 2008
@@ -0,0 +1,389 @@
+diff -Nru fbterm-1.2/src/fbshell.cpp fbterm-1.2.new/src/fbshell.cpp
+--- fbterm-1.2/src/fbshell.cpp	2008-10-12 11:50:02.000000000 +0200
++++ fbterm-1.2.new/src/fbshell.cpp	2008-12-16 15:05:03.000000000 +0100
+@@ -32,22 +32,270 @@
+ #define screen (Screen::instance())
+ 
+ static const Color defaultPalette[NR_COLORS] = {
+-	{ 0,	0,		0 },
+-	{ 0,	0,		0xaa },
+-	{ 0, 	0xaa,	0 },
+-	{ 0,	0x55,	0xaa },
+-	{ 0xaa,	0,		0 },
+-	{ 0xaa,	0,		0xaa },
+-	{ 0xaa,	0xaa,	0 },
+-	{ 0xaa,	0xaa,	0xaa },
+-	{ 0x55,	0x55,	0x55 },
+-	{ 0x55,	0x55,	0xff },
+-	{ 0x55,	0xff,	0x55 },
+-	{ 0x55,	0xff,	0xff },
+-	{ 0xff,	0x55,	0x55 },
+-	{ 0xff,	0x55,	0xff },
+-	{ 0xff,	0xff,	0x55 },
+-	{ 0xff,	0xff,	0xff },
++	{0x00, 0x00, 0x00}, /* 0 */
++	{0xaa, 0x00, 0x00}, /* 1 */
++	{0x00, 0xaa, 0x00}, /* 2 */
++	{0xaa, 0x55, 0x00}, /* 3 */
++	{0x00, 0x00, 0xaa}, /* 4 */
++	{0xaa, 0x00, 0xaa}, /* 5 */
++	{0x00, 0xaa, 0xaa}, /* 6 */
++	{0xaa, 0xaa, 0xaa}, /* 7 */
++	{0x55, 0x55, 0x55}, /* 8 */
++	{0xff, 0x55, 0x55}, /* 9 */
++	{0x55, 0xff, 0x55}, /* 10 */
++	{0xff, 0xff, 0x55}, /* 11 */
++	{0x55, 0x55, 0xff}, /* 12 */
++	{0xff, 0x55, 0xff}, /* 13 */
++	{0x55, 0xff, 0xff}, /* 14 */
++	{0xff, 0xff, 0xff}, /* 15 */
++
++	{0x00, 0x00, 0x00}, /* 16 */
++	{0x00, 0x00, 0x5f}, /* 17 */
++	{0x00, 0x00, 0x87}, /* 18 */
++	{0x00, 0x00, 0xaf}, /* 19 */
++	{0x00, 0x00, 0xd7}, /* 20 */
++	{0x00, 0x00, 0xff}, /* 21 */
++	{0x00, 0x5f, 0x00}, /* 22 */
++	{0x00, 0x5f, 0x5f}, /* 23 */
++	{0x00, 0x5f, 0x87}, /* 24 */
++	{0x00, 0x5f, 0xaf}, /* 25 */
++	{0x00, 0x5f, 0xd7}, /* 26 */
++	{0x00, 0x5f, 0xff}, /* 27 */
++	{0x00, 0x87, 0x00}, /* 28 */
++	{0x00, 0x87, 0x5f}, /* 29 */
++	{0x00, 0x87, 0x87}, /* 30 */
++	{0x00, 0x87, 0xaf}, /* 31 */
++	{0x00, 0x87, 0xd7}, /* 32 */
++	{0x00, 0x87, 0xff}, /* 33 */
++	{0x00, 0xaf, 0x00}, /* 34 */
++	{0x00, 0xaf, 0x5f}, /* 35 */
++	{0x00, 0xaf, 0x87}, /* 36 */
++	{0x00, 0xaf, 0xaf}, /* 37 */
++	{0x00, 0xaf, 0xd7}, /* 38 */
++	{0x00, 0xaf, 0xff}, /* 39 */
++	{0x00, 0xd7, 0x00}, /* 40 */
++	{0x00, 0xd7, 0x5f}, /* 41 */
++	{0x00, 0xd7, 0x87}, /* 42 */
++	{0x00, 0xd7, 0xaf}, /* 43 */
++	{0x00, 0xd7, 0xd7}, /* 44 */
++	{0x00, 0xd7, 0xff}, /* 45 */
++	{0x00, 0xff, 0x00}, /* 46 */
++	{0x00, 0xff, 0x5f}, /* 47 */
++	{0x00, 0xff, 0x87}, /* 48 */
++	{0x00, 0xff, 0xaf}, /* 49 */
++	{0x00, 0xff, 0xd7}, /* 50 */
++	{0x00, 0xff, 0xff}, /* 51 */
++
++	{0x5f, 0x00, 0x00}, /* 52 */
++	{0x5f, 0x00, 0x5f}, /* 53 */
++	{0x5f, 0x00, 0x87}, /* 54 */
++	{0x5f, 0x00, 0xaf}, /* 55 */
++	{0x5f, 0x00, 0xd7}, /* 56 */
++	{0x5f, 0x00, 0xff}, /* 57 */
++	{0x5f, 0x5f, 0x00}, /* 58 */
++	{0x5f, 0x5f, 0x5f}, /* 59 */
++	{0x5f, 0x5f, 0x87}, /* 60 */
++	{0x5f, 0x5f, 0xaf}, /* 61 */
++	{0x5f, 0x5f, 0xd7}, /* 62 */
++	{0x5f, 0x5f, 0xff}, /* 63 */
++	{0x5f, 0x87, 0x00}, /* 64 */
++	{0x5f, 0x87, 0x5f}, /* 65 */
++	{0x5f, 0x87, 0x87}, /* 66 */
++	{0x5f, 0x87, 0xaf}, /* 67 */
++	{0x5f, 0x87, 0xd7}, /* 68 */
++	{0x5f, 0x87, 0xff}, /* 69 */
++	{0x5f, 0xaf, 0x00}, /* 70 */
++	{0x5f, 0xaf, 0x5f}, /* 71 */
++	{0x5f, 0xaf, 0x87}, /* 72 */
++	{0x5f, 0xaf, 0xaf}, /* 73 */
++	{0x5f, 0xaf, 0xd7}, /* 74 */
++	{0x5f, 0xaf, 0xff}, /* 75 */
++	{0x5f, 0xd7, 0x00}, /* 76 */
++	{0x5f, 0xd7, 0x5f}, /* 77 */
++	{0x5f, 0xd7, 0x87}, /* 78 */
++	{0x5f, 0xd7, 0xaf}, /* 79 */
++	{0x5f, 0xd7, 0xd7}, /* 80 */
++	{0x5f, 0xd7, 0xff}, /* 81 */
++	{0x5f, 0xff, 0x00}, /* 82 */
++	{0x5f, 0xff, 0x5f}, /* 83 */
++	{0x5f, 0xff, 0x87}, /* 84 */
++	{0x5f, 0xff, 0xaf}, /* 85 */
++	{0x5f, 0xff, 0xd7}, /* 86 */
++	{0x5f, 0xff, 0xff}, /* 87 */
++
++	{0x87, 0x00, 0x00}, /* 88 */
++	{0x87, 0x00, 0x5f}, /* 89 */
++	{0x87, 0x00, 0x87}, /* 90 */
++	{0x87, 0x00, 0xaf}, /* 91 */
++	{0x87, 0x00, 0xd7}, /* 92 */
++	{0x87, 0x00, 0xff}, /* 93 */
++	{0x87, 0x5f, 0x00}, /* 94 */
++	{0x87, 0x5f, 0x5f}, /* 95 */
++	{0x87, 0x5f, 0x87}, /* 96 */
++	{0x87, 0x5f, 0xaf}, /* 97 */
++	{0x87, 0x5f, 0xd7}, /* 98 */
++	{0x87, 0x5f, 0xff}, /* 99 */
++	{0x87, 0x87, 0x00}, /* 100 */
++	{0x87, 0x87, 0x5f}, /* 101 */
++	{0x87, 0x87, 0x87}, /* 102 */
++	{0x87, 0x87, 0xaf}, /* 103 */
++	{0x87, 0x87, 0xd7}, /* 104 */
++	{0x87, 0x87, 0xff}, /* 105 */
++	{0x87, 0xaf, 0x00}, /* 106 */
++	{0x87, 0xaf, 0x5f}, /* 107 */
++	{0x87, 0xaf, 0x87}, /* 108 */
++	{0x87, 0xaf, 0xaf}, /* 109 */
++	{0x87, 0xaf, 0xd7}, /* 110 */
++	{0x87, 0xaf, 0xff}, /* 111 */
++	{0x87, 0xd7, 0x00}, /* 112 */
++	{0x87, 0xd7, 0x5f}, /* 113 */
++	{0x87, 0xd7, 0x87}, /* 114 */
++	{0x87, 0xd7, 0xaf}, /* 115 */
++	{0x87, 0xd7, 0xd7}, /* 116 */
++	{0x87, 0xd7, 0xff}, /* 117 */
++	{0x87, 0xff, 0x00}, /* 118 */
++	{0x87, 0xff, 0x5f}, /* 119 */
++	{0x87, 0xff, 0x87}, /* 120 */
++	{0x87, 0xff, 0xaf}, /* 121 */
++	{0x87, 0xff, 0xd7}, /* 122 */
++	{0x87, 0xff, 0xff}, /* 123 */
++
++	{0xaf, 0x00, 0x00}, /* 124 */
++	{0xaf, 0x00, 0x5f}, /* 125 */
++	{0xaf, 0x00, 0x87}, /* 126 */
++	{0xaf, 0x00, 0xaf}, /* 127 */
++	{0xaf, 0x00, 0xd7}, /* 128 */
++	{0xaf, 0x00, 0xff}, /* 129 */
++	{0xaf, 0x5f, 0x00}, /* 130 */
++	{0xaf, 0x5f, 0x5f}, /* 131 */
++	{0xaf, 0x5f, 0x87}, /* 132 */
++	{0xaf, 0x5f, 0xaf}, /* 133 */
++	{0xaf, 0x5f, 0xd7}, /* 134 */
++	{0xaf, 0x5f, 0xff}, /* 135 */
++	{0xaf, 0x87, 0x00}, /* 136 */
++	{0xaf, 0x87, 0x5f}, /* 137 */
++	{0xaf, 0x87, 0x87}, /* 138 */
++	{0xaf, 0x87, 0xaf}, /* 139 */
++	{0xaf, 0x87, 0xd7}, /* 140 */
++	{0xaf, 0x87, 0xff}, /* 141 */
++	{0xaf, 0xaf, 0x00}, /* 142 */
++	{0xaf, 0xaf, 0x5f}, /* 143 */
++	{0xaf, 0xaf, 0x87}, /* 144 */
++	{0xaf, 0xaf, 0xaf}, /* 145 */
++	{0xaf, 0xaf, 0xd7}, /* 146 */
++	{0xaf, 0xaf, 0xff}, /* 147 */
++	{0xaf, 0xd7, 0x00}, /* 148 */
++	{0xaf, 0xd7, 0x5f}, /* 149 */
++	{0xaf, 0xd7, 0x87}, /* 150 */
++	{0xaf, 0xd7, 0xaf}, /* 151 */
++	{0xaf, 0xd7, 0xd7}, /* 152 */
++	{0xaf, 0xd7, 0xff}, /* 153 */
++	{0xaf, 0xff, 0x00}, /* 154 */
++	{0xaf, 0xff, 0x5f}, /* 155 */
++	{0xaf, 0xff, 0x87}, /* 156 */
++	{0xaf, 0xff, 0xaf}, /* 157 */
++	{0xaf, 0xff, 0xd7}, /* 158 */
++	{0xaf, 0xff, 0xff}, /* 159 */
++
++	{0xd7, 0x00, 0x00}, /* 160 */
++	{0xd7, 0x00, 0x5f}, /* 161 */
++	{0xd7, 0x00, 0x87}, /* 162 */
++	{0xd7, 0x00, 0xaf}, /* 163 */
++	{0xd7, 0x00, 0xd7}, /* 164 */
++	{0xd7, 0x00, 0xff}, /* 165 */
++	{0xd7, 0x5f, 0x00}, /* 166 */
++	{0xd7, 0x5f, 0x5f}, /* 167 */
++	{0xd7, 0x5f, 0x87}, /* 168 */
++	{0xd7, 0x5f, 0xaf}, /* 169 */
++	{0xd7, 0x5f, 0xd7}, /* 170 */
++	{0xd7, 0x5f, 0xff}, /* 171 */
++	{0xd7, 0x87, 0x00}, /* 172 */
++	{0xd7, 0x87, 0x5f}, /* 173 */
++	{0xd7, 0x87, 0x87}, /* 174 */
++	{0xd7, 0x87, 0xaf}, /* 175 */
++	{0xd7, 0x87, 0xd7}, /* 176 */
++	{0xd7, 0x87, 0xff}, /* 177 */
++	{0xd7, 0xaf, 0x00}, /* 178 */
++	{0xd7, 0xaf, 0x5f}, /* 179 */
++	{0xd7, 0xaf, 0x87}, /* 180 */
++	{0xd7, 0xaf, 0xaf}, /* 181 */
++	{0xd7, 0xaf, 0xd7}, /* 182 */
++	{0xd7, 0xaf, 0xff}, /* 183 */
++	{0xd7, 0xd7, 0x00}, /* 184 */
++	{0xd7, 0xd7, 0x5f}, /* 185 */
++	{0xd7, 0xd7, 0x87}, /* 186 */
++	{0xd7, 0xd7, 0xaf}, /* 187 */
++	{0xd7, 0xd7, 0xd7}, /* 188 */
++	{0xd7, 0xd7, 0xff}, /* 189 */
++	{0xd7, 0xff, 0x00}, /* 190 */
++	{0xd7, 0xff, 0x5f}, /* 191 */
++	{0xd7, 0xff, 0x87}, /* 192 */
++	{0xd7, 0xff, 0xaf}, /* 193 */
++	{0xd7, 0xff, 0xd7}, /* 194 */
++	{0xd7, 0xff, 0xff}, /* 195 */
++
++	{0xff, 0x00, 0x00}, /* 196 */
++	{0xff, 0x00, 0x5f}, /* 197 */
++	{0xff, 0x00, 0x87}, /* 198 */
++	{0xff, 0x00, 0xaf}, /* 199 */
++	{0xff, 0x00, 0xd7}, /* 200 */
++	{0xff, 0x00, 0xff}, /* 201 */
++	{0xff, 0x5f, 0x00}, /* 202 */
++	{0xff, 0x5f, 0x5f}, /* 203 */
++	{0xff, 0x5f, 0x87}, /* 204 */
++	{0xff, 0x5f, 0xaf}, /* 205 */
++	{0xff, 0x5f, 0xd7}, /* 206 */
++	{0xff, 0x5f, 0xff}, /* 207 */
++	{0xff, 0x87, 0x00}, /* 208 */
++	{0xff, 0x87, 0x5f}, /* 209 */
++	{0xff, 0x87, 0x87}, /* 210 */
++	{0xff, 0x87, 0xaf}, /* 211 */
++	{0xff, 0x87, 0xd7}, /* 212 */
++	{0xff, 0x87, 0xff}, /* 213 */
++	{0xff, 0xaf, 0x00}, /* 214 */
++	{0xff, 0xaf, 0x5f}, /* 215 */
++	{0xff, 0xaf, 0x87}, /* 216 */
++	{0xff, 0xaf, 0xaf}, /* 217 */
++	{0xff, 0xaf, 0xd7}, /* 218 */
++	{0xff, 0xaf, 0xff}, /* 219 */
++	{0xff, 0xd7, 0x00}, /* 220 */
++	{0xff, 0xd7, 0x5f}, /* 221 */
++	{0xff, 0xd7, 0x87}, /* 222 */
++	{0xff, 0xd7, 0xaf}, /* 223 */
++	{0xff, 0xd7, 0xd7}, /* 224 */
++	{0xff, 0xd7, 0xff}, /* 225 */
++	{0xff, 0xff, 0x00}, /* 226 */
++	{0xff, 0xff, 0x5f}, /* 227 */
++	{0xff, 0xff, 0x87}, /* 228 */
++	{0xff, 0xff, 0xaf}, /* 229 */
++	{0xff, 0xff, 0xd7}, /* 230 */
++	{0xff, 0xff, 0xff}, /* 231 */
++
++	{0x08, 0x08, 0x08}, /* 232 */
++	{0x12, 0x12, 0x12}, /* 233 */
++	{0x1c, 0x1c, 0x1c}, /* 234 */
++	{0x26, 0x26, 0x26}, /* 235 */
++	{0x30, 0x30, 0x30}, /* 236 */
++	{0x3a, 0x3a, 0x3a}, /* 237 */
++	{0x44, 0x44, 0x44}, /* 238 */
++	{0x4e, 0x4e, 0x4e}, /* 239 */
++	{0x58, 0x58, 0x58}, /* 240 */
++	{0x62, 0x62, 0x62}, /* 241 */
++	{0x6c, 0x6c, 0x6c}, /* 242 */
++	{0x76, 0x76, 0x76}, /* 243 */
++	{0x80, 0x80, 0x80}, /* 244 */
++	{0x8a, 0x8a, 0x8a}, /* 245 */
++	{0x94, 0x94, 0x94}, /* 246 */
++	{0x9e, 0x9e, 0x9e}, /* 247 */
++	{0xa8, 0xa8, 0xa8}, /* 248 */
++	{0xb2, 0xb2, 0xb2}, /* 249 */
++	{0xbc, 0xbc, 0xbc}, /* 250 */
++	{0xc6, 0xc6, 0xc6}, /* 251 */
++	{0xd0, 0xd0, 0xd0}, /* 252 */
++	{0xda, 0xda, 0xda}, /* 253 */
++	{0xe4, 0xe4, 0xe4}, /* 254 */
++	{0xee, 0xee, 0xee}, /* 255 */
++
+ };
+ 
+ u16 VTerm::init_history_lines()
+diff -Nru fbterm-1.2/src/fbshell.h fbterm-1.2.new/src/fbshell.h
+--- fbterm-1.2/src/fbshell.h	2008-10-12 11:50:02.000000000 +0200
++++ fbterm-1.2.new/src/fbshell.h	2008-12-16 14:57:08.000000000 +0100
+@@ -23,10 +23,10 @@
+ #include "instance.h"
+ #include "shell.h"
+ 
+-#define NR_COLORS 16
++#define NR_COLORS 256
+ 
+ struct Color {
+-	u8 blue, green, red;
++	u8 red, green, blue;
+ };
+ 	
+ class FbShell : public Shell {
+diff -Nru fbterm-1.2/src/lib/vterm_action.cpp fbterm-1.2.new/src/lib/vterm_action.cpp
+--- fbterm-1.2/src/lib/vterm_action.cpp	2008-10-12 11:50:02.000000000 +0200
++++ fbterm-1.2.new/src/lib/vterm_action.cpp	2008-12-16 14:28:19.000000000 +0100
+@@ -466,9 +466,43 @@
+ 	enable_mode(false);
+ }
+ 
++
+ void VTerm::set_display_attr()
+ {
++	enum mode_256 {
++		MODE_256_NORMAL,
++		MODE_256_WAS_FOREGROUND_38,
++		MODE_256_WAS_FOREGROUND_5,
++		MODE_256_WAS_BACKGROUND_48,
++		MODE_256_WAS_BACKGROUND_5
++	};
++	mode_256 mode = MODE_256_NORMAL;
++	bool tmp_underline;
++	int tmp_fcolor;
++
+ 	for (s32 n = 0; n <= npar; n++) {
++		if (mode == MODE_256_WAS_FOREGROUND_5) {
++			char_attr.fcolor = param[n];
++			mode = MODE_256_NORMAL;
++			continue;
++		}
++		if (mode == MODE_256_WAS_BACKGROUND_5) {
++			char_attr.bcolor = param[n];
++			mode = MODE_256_NORMAL;
++			continue;
++		}
++		if (param[n] == 5 && mode != MODE_256_NORMAL) {
++			if (mode == MODE_256_WAS_FOREGROUND_38) {
++				char_attr.fcolor = tmp_fcolor;
++				char_attr.underline = tmp_underline;
++				mode = MODE_256_WAS_FOREGROUND_5;
++			} else if (mode == MODE_256_WAS_BACKGROUND_48) {
++				mode = MODE_256_WAS_BACKGROUND_5;
++			}
++			continue;
++		}
++		mode = MODE_256_NORMAL;
++
+ 		switch (param[n]) {
+ 		case 0:
+ 			char_attr = default_char_attr;
+@@ -523,8 +557,11 @@
+ 			char_attr.fcolor = param[n] % 10;
+ 			break;
+ 		case 38:
++			tmp_fcolor = char_attr.fcolor;
++			tmp_underline = char_attr.underline;
+ 			char_attr.fcolor = default_fcolor;
+ 			char_attr.underline = true;
++			mode = MODE_256_WAS_FOREGROUND_38;
+ 			break;
+ 		case 39:
+ 			char_attr.fcolor = default_fcolor;
+@@ -533,6 +570,9 @@
+ 		case 40 ... 47:
+ 			char_attr.bcolor = param[n] % 10;
+ 			break;
++		case 48:
++			mode = MODE_256_WAS_BACKGROUND_48;
++			break;
+ 		case 49:
+ 			char_attr.bcolor = default_bcolor;
+ 			break;
+diff -Nru fbterm-1.2/src/lib/vterm.h fbterm-1.2.new/src/lib/vterm.h
+--- fbterm-1.2/src/lib/vterm.h	2008-10-12 11:50:02.000000000 +0200
++++ fbterm-1.2.new/src/lib/vterm.h	2008-12-16 14:23:50.000000000 +0100
+@@ -39,8 +39,8 @@
+ 				|| italic != a.italic || underline != a.underline || blink != a.blink || reverse != a.reverse;
+ 		}
+ 
+-		s32 fcolor : 5;	// -1 = default
+-		s32 bcolor : 5;	// -1 = default
++		s32 fcolor : 9;	// -1 = default
++		s32 bcolor : 9;	// -1 = default
+ 		u32 intensity : 2; // 0 = half-bright, 1 = normal, 2 = bold
+ 		u32 italic : 1;
+ 		u32 underline : 1;
================================================================


More information about the pld-cvs-commit mailing list