Commit c8cabf95 authored by Thomas Perl's avatar Thomas Perl

Merge pull request #28 from FireyFly/master

Add 256-colour support
parents 9f253372 3b52af7b
......@@ -747,6 +747,19 @@ void Terminal::ansiSequence(const QString& seq)
break;
}
if(params.count() > 0) {
// xterm 256-colour support
if(params.count() > 1 && (params[0] == 38 || params[0] == 48)) {
if(params.count() > 2 && params[1] == 5 &&
params[2] >= 0 && params[2] <= 255) {
if(params[0] == 38)
iTermAttribs.currentFgColor = params[2];
else
iTermAttribs.currentBgColor = params[2];
}
// TODO: 2;r;g;b for 24-bit colour support (Konsole etc)
break;
}
if(params.contains(0)) {
iTermAttribs.currentFgColor = defaultFgColor;
iTermAttribs.currentBgColor = defaultBgColor;
......@@ -774,6 +787,17 @@ void Terminal::ansiSequence(const QString& seq)
iTermAttribs.currentBgColor = p-40;
}
}
// high-intensity regular-weight extension (nonstandard)
foreach(int p, params) {
if(p >= 90 && p<= 97) {
iTermAttribs.currentFgColor = p-90+8;
}
if(p >= 100 && p<= 107) {
iTermAttribs.currentBgColor = p-100+8;
}
}
if(params.contains(39))
iTermAttribs.currentFgColor = defaultFgColor;
if(params.contains(49))
......
......@@ -42,6 +42,7 @@ TextRender::TextRender(QQuickItem *parent) :
iColorTable.append(QColor(210, 0, 210));
iColorTable.append(QColor(0, 210, 210));
iColorTable.append(QColor(235, 235, 235));
//bright
iColorTable.append(QColor(127, 127, 127));
iColorTable.append(QColor(255, 0, 0));
......@@ -52,7 +53,21 @@ TextRender::TextRender(QQuickItem *parent) :
iColorTable.append(QColor(0, 255, 255));
iColorTable.append(QColor(255, 255, 255));
if(iColorTable.size()!=16)
//colour cube
for (int r = 0x00; r < 0x100; r += 0x33)
for (int g = 0x00; g < 0x100; g += 0x33)
for (int b = 0x00; b < 0x100; b += 0x33)
iColorTable.append(QColor(r, g, b));
//greyscale ramp
int ramp[] = {
0, 11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121,
133, 144, 155, 166, 177, 188, 199, 210, 221, 232, 243, 255
};
for (int i = 0; i < 24; i++)
iColorTable.append(QColor(ramp[i], ramp[i], ramp[i]));
if(iColorTable.size() != 256)
qFatal("invalid color table");
iShowBufferScrollIndicator = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment