[prev in list] [next in list] [prev in thread] [next in thread] 

List:       konsole-devel
Subject:    Re: [Konsole-devel] [Bug 107487] PATCH - Please add the xterm-256
From:       lars.doelle () on-line ! de
Date:       2006-06-24 22:25:07
Message-ID: 200606250025.07439.lars.doelle () on-line ! de
[Download RAW message or body]

Witek, All,

find attached a patch along the lines of Witek's work and my
previous reply.

The patch introduces colour spaces to represent colours in
screen now, thereby localising the necessary changes.

Though the patch is relatively local and survived my testing,
it is pretty intrusive and has the potential to break some of
the rendition hacks, that i'm not aware of. The changes i find
critical are all in TEWidget.C. In particular, I could make no
sense off:

    image[i].c = 0xff; //' ';
    image[i].f = 0xff; //DEFAULT_FORE_COLOR;
    image[i].b = 0xff; //DEFAULT_BACK_COLOR;
    image[i].r = 0xff; //DEFAULT_RENDITION;

so i reverted this one to the original code.

-lars

["colorspaces-001.patch" (text/x-diff)]

--- README.moreColors.orig	2006-06-24 23:57:40.000000000 +0200
+++ README.moreColors	2006-06-24 23:56:59.000000000 +0200
@@ -0,0 +1,95 @@
+[README.moreColors]
+
+The konsole adopted some ESC codes allowing to use extended
+color spaces.
+
+There is a predefined 256 color space compatible with his
+xterm sister, and, even beyond that, a 3-byte RGB color space.
+
+The ESC codes are as follows:
+
+   ESC[ ... 38;2;<r>;<g>;<b> ... m   Select RGB foreground color
+   ESC[ ... 48;2;<r>;<g>;<b> ... m   Select RGB background color
+
+   ESC[ ... 38;5;<i> ... m       Select indexed foreground color
+   ESC[ ... 48;5;<i> ... m       Select indexed background color
+
+<r>,<g> and <b> are each values in the range of 0..255 and
+represent the brightness as usual for the respective color.
+
+<i> likely is a value in 0..256, but represents an indexed
+color assignment composed as follows:
+
+  0 ..  15 - System color, these are taken from the schema.
+ 16 .. 231 - Forms a 6x6x6 RGB color cube.
+232 .. 255 - A gray scale ramp without black and white.
+
+Try the tests/256colors.pl to visualize the assignment.
+
+
+----------------------------------------------------------------
+
+A note on conformance
+
+These ESC codes break the "associativity" of SGR, but after some
+research the result is, that the standard itself is broken here.
+
+The perhaps best codes due to ECMA-48 would probably be e.g.
+38:2:<r>:<g>:<b>, i.e. consistently a colon instead of a semicolon.
+But apparently, this is defined different in ISO-8613 (which is
+included at this place in ECMA-48), actually breaking ECMA-48.
+
+We cannot help this and implemented the codes as above, which
+is a balanced decision.
+
+
+| ------- Additional Comments From awendt putergeek com  2006-06-07 07:40 -------
+| > So a parameter substring is 0-9 and the colon. The semicolon separates
+| > sub-parameters. Thus 48:5:<Color> would be one sub-parameter, and
+| > 48;5;<Color> many independent, each having an independent meaning in case
+| > of a selective parameter.
+| 
+| 
+| I think you may be onto something here with the colons... I was able to find 
+| ITU T.416 (which is the same as ISO 8613-6) and it says:
+| 
+| --- snip ---
+| 
+| The parameter values 38 and 48 are followed by a parameter substring used to 
+| select either the character foreground ?colour value? or the character 
+| background ?colour value?.
+| 
+| A parameter substring for values 38 or 48 may be divided by one or more 
+| separators (03/10) into parameter elements, denoted as Pe. The format of such 
+| a parameter sub-string is indicated as:
+| 
+|          Pe : P ...
+| 
+| Each parameter element consists of zero, one or more bit combinations from 
+| 03/00 to 03/09, representing the digits 0 to 9. An empty parameter element 
+| represents a default value for this parameter element. Empty parameter 
+| elements at the end of the parameter substring need not be included.
+| 
+| The first parameter element indicates a choice between:
+| 
+|            0   implementation defined (only applicable for the character 
+| foreground colour)
+|            1   transparent;
+|            2   direct colour in RGB space;
+|            3   direct colour in CMY space;
+|            4   direct colour in CMYK space;
+|            5   indexed colour.
+| 
+| If the first parameter has the value 0 or 1, there are no additional parameter 
+| elements.
+| 
+| If the first parameter element has the value 5, then there is a second 
+| parameter element specifying the index into the colour table given by the 
+| attribute ?content colour table? applying to the object with which the 
+| content is associated.
+| 
+| --- snip ---
+| 
+| The separator character 03/10 they use is a colon, not a semicolon... I wonder 
+| if the xterm implementation was based on an improper reading of the standard?
+| 
--- konsole/TECommon.h.orig	2005-05-12 02:02:53.000000000 +0200
+++ konsole/TECommon.h	2006-06-24 22:39:12.000000000 +0200
@@ -27,6 +27,24 @@
 typedef unsigned short UINT16;
 #endif
 
+// Color Table Elements ///////////////////////////////////////////////
+
+/*!
+*/
+struct ColorEntry
+{
+  ColorEntry(QColor c, bool tr, bool b) : color(c), transparent(tr), bold(b) {}
+  ColorEntry() : transparent(false), bold(false) {} // default constructors
+  void operator=(const ColorEntry& rhs) { 
+       color = rhs.color; 
+       transparent = rhs.transparent; 
+       bold = rhs.bold; 
+  }
+  QColor color;
+  bool   transparent; // if used on bg
+  bool   bold;        // if used on fg
+};
+
 // Attributed Character Representations ///////////////////////////////
 
 // Colors
@@ -46,6 +64,115 @@
 #define RE_INTENSIVE       (1 << 3) // Widget only
 #define RE_CURSOR          (1 << 4)
 
+
+/* cacol is a union of the various color spaces.
+
+   Assignment is as follows:
+
+   Type  - Space        - Values
+
+   0     - Undefined   - u:  0,      v:0        w:0
+   1     - Default     - u:  0..1    v:intense  w:0
+   2     - System      - u:  0..7    v:intense  w:0
+   3     - Index(256)  - u: 16..255  v:0        w:0
+   4     - RGB         - u:  0..255  v:0..256   w:0..256
+
+   Default colour space has two separate colours, namely
+   default foreground and default background colour.
+*/
+
+#define CO_UND 0
+#define CO_DFT 1
+#define CO_SYS 2
+#define CO_256 3
+#define CO_RGB 4
+
+class cacol
+{
+public:
+  cacol();
+  cacol(UINT8 space, int color);
+  UINT8 t; // color space indicator
+  UINT8 u; // various bytes representing the data in the respective ...
+  UINT8 v; // ... color space. C++ does not do unions, so we cannot ...
+  UINT8 w; // ... express ourselfs here, properly.
+  void toggleIntensive(); // Hack or helper?
+  QColor color(const ColorEntry* base) const;
+  friend bool operator == (cacol a, cacol b);
+  friend bool operator != (cacol a, cacol b);
+};
+
+#if 0
+inline cacol::cacol(UINT8 _t, UINT8 _u, UINT8 _v, UINT8 _w)
+: t(_t), u(_u), v(_v), w(_w)
+{
+}
+#else
+inline cacol::cacol(UINT8 ty, int co)
+: t(ty), u(0), v(0), w(0)
+{
+  switch (t)
+  {
+    case CO_UND:                                break;
+    case CO_DFT: u = co&  1;                    break;
+    case CO_SYS: u = co&  7; v = (co>>3)&1;     break;
+    case CO_256: u = co&255;                    break;
+    case CO_RGB: u = co>>16; v = co>>8; w = co; break;
+    default    : t = 0;                         break;
+  }
+}
+#endif
+
+inline cacol::cacol() // undefined, really
+: t(CO_UND), u(0), v(0), w(0)
+{
+}
+
+inline bool operator == (cacol a, cacol b)
+{ 
+  return a.t == b.t && a.u == b.u && a.v == b.v && a.w == b.w;
+}
+
+inline bool operator != (cacol a, cacol b)
+{
+  return a.t != b.t || a.u != b.u || a.v != b.v || a.w != b.w;
+}
+
+inline const QColor color256(UINT8 u, const ColorEntry* base)
+{
+  //   0.. 16: system colors
+  if (u <   8) return base[u+2            ].color; u -= 8;
+  if (u <   8) return base[u+2+BASE_COLORS].color; u -= 8;
+
+  //  16..231: 6x6x6 rgb color cube
+  if (u < 216) return QColor(255*((u/36)%6)/6,
+                             255*((u/ 6)%6)/6,
+                             255*((u/ 1)%6)/6); u -= 216;
+  
+  // 232..255: gray, leaving out black and white
+  int gray = u*10+8; return QColor(gray,gray,gray);
+}
+
+inline QColor cacol::color(const ColorEntry* base) const
+{
+  switch (t)
+  {
+    case CO_DFT: return base[u+0+(v?BASE_COLORS:0)].color;
+    case CO_SYS: return base[u+2+(v?BASE_COLORS:0)].color;
+    case CO_256: return color256(u,base);
+    case CO_RGB: return QColor(u,v,w);
+    default    : return QColor(255,0,0); // diagnostic catch all
+  }
+}
+
+inline void cacol::toggleIntensive()
+{
+  if (t == CO_SYS || t == CO_DFT)
+  {
+    v = !v;
+  }
+}
+
 /*! \class ca
  *  \brief a character with rendition attributes.
 */
@@ -54,22 +181,28 @@
 {
 public:
   inline ca(UINT16 _c = ' ',
-            UINT8 _f = DEFAULT_FORE_COLOR,
-            UINT8 _b = DEFAULT_BACK_COLOR,
-            UINT8 _r = DEFAULT_RENDITION)
-       : c(_c), f(_f), b(_b), r(_r) {}
+            cacol  _f = cacol(CO_DFT,DEFAULT_FORE_COLOR),
+            cacol  _b = cacol(CO_DFT,DEFAULT_BACK_COLOR),
+            UINT8  _r = DEFAULT_RENDITION)
+       : c(_c), r(_r), f(_f), b(_b) {}
 public:
   UINT16 c; // character
-  UINT8  f; // foreground color
-  UINT8  b; // background color
   UINT8  r; // rendition
+  cacol  f; // foreground color
+  cacol  b; // background color
+public:
+  //FIXME: following a hack to cope with various color spaces
+  // it brings the rendition pipeline further out of balance,
+  // which it was anyway as the result of various additions.
+  bool   isTransparent(const ColorEntry* base) const;
+  bool   isBold(const ColorEntry* base) const;
 public:
   friend bool operator == (ca a, ca b);
   friend bool operator != (ca a, ca b);
 };
 
 inline bool operator == (ca a, ca b)
-{
+{ 
   return a.c == b.c && a.f == b.f && a.b == b.b && a.r == b.r;
 }
 
@@ -78,20 +211,14 @@
   return a.c != b.c || a.f != b.f || a.b != b.b || a.r != b.r;
 }
 
-/*!
-*/
-struct ColorEntry
+inline bool ca::isTransparent(const ColorEntry* base) const
 {
-  ColorEntry(QColor c, bool tr, bool b) : color(c), transparent(tr), bold(b) {}
-  ColorEntry() : transparent(false), bold(false) {} // default constructors
-  void operator=(const ColorEntry& rhs) { 
-       color = rhs.color; 
-       transparent = rhs.transparent; 
-       bold = rhs.bold; 
-  }
-  QColor color;
-  bool   transparent; // if used on bg
-  bool   bold;        // if used on fg
-};
+  return (b.t == CO_SYS || b.t == CO_DFT) && base[b.u].transparent;
+}
+
+inline bool ca::isBold(const ColorEntry* base) const
+{
+  return (f.t == CO_SYS || b.t == CO_DFT) && base[f.u].bold;
+}
 
 #endif // TECOMMON_H
--- konsole/TEScreen.cpp.orig	2006-05-02 01:31:32.000000000 +0200
+++ konsole/TEScreen.cpp	2006-06-24 23:14:35.000000000 +0200
@@ -67,15 +67,15 @@
     histCursor(0),
     hist(new HistoryScrollNone()),
     cuX(0), cuY(0),
-    cu_fg(0), cu_bg(0), cu_re(0),
+    cu_fg(cacol()), cu_bg(cacol()), cu_re(0),
     tmargin(0), bmargin(0),
     tabstops(0),
     sel_begin(0), sel_TL(0), sel_BR(0),
     sel_busy(false),
     columnmode(false),
-    ef_fg(0), ef_bg(0), ef_re(0),
+    ef_fg(cacol()), ef_bg(cacol()), ef_re(0),
     sa_cuX(0), sa_cuY(0),
-    sa_cu_re(0), sa_cu_fg(0), sa_cu_bg(0),
+    sa_cu_re(0), sa_cu_fg(cacol()), sa_cu_bg(cacol()),
     lastPos(-1)
 {
   /*
@@ -425,8 +425,8 @@
     for (int x = 0; x < new_columns; x++)
     {
       newimg[y*new_columns+x].c = ' ';
-      newimg[y*new_columns+x].f = DEFAULT_FORE_COLOR;
-      newimg[y*new_columns+x].b = DEFAULT_BACK_COLOR;
+      newimg[y*new_columns+x].f = cacol(CO_DFT,DEFAULT_FORE_COLOR);
+      newimg[y*new_columns+x].b = cacol(CO_DFT,DEFAULT_BACK_COLOR);
       newimg[y*new_columns+x].r = DEFAULT_RENDITION;
     }
     newwrapped[y]=false;
@@ -494,7 +494,7 @@
 */
 
 void TEScreen::reverseRendition(ca* p)
-{ UINT8 f = p->f; UINT8 b = p->b;
+{ cacol f = p->f; cacol b = p->b;
   p->f = b; p->b = f; //p->r &= ~RE_TRANSPARENT;
 }
 
@@ -513,12 +513,7 @@
     ef_bg = cu_bg;
   }
   if (cu_re & RE_BOLD)
-  {
-    if (ef_fg < BASE_COLORS)
-      ef_fg += BASE_COLORS;
-    else
-      ef_fg -= BASE_COLORS;
-  }
+    ef_fg.toggleIntensive();
 }
 
 /*!
@@ -540,7 +535,7 @@
 
   int x,y;
   ca* merged = (ca*)malloc((lines*columns+1)*sizeof(ca));
-  ca dft(' ',DEFAULT_FORE_COLOR,DEFAULT_BACK_COLOR,DEFAULT_RENDITION);
+  ca dft(' ',cacol(CO_DFT,DEFAULT_FORE_COLOR),cacol(CO_DFT,DEFAULT_BACK_COLOR),DEFAULT_RENDITION);
  merged[lines*columns] = dft;
 
 //  kdDebug(1211) << "InGetCookedImage" << endl;
@@ -1082,45 +1077,25 @@
 
 void TEScreen::setDefaultRendition()
 {
-  setForeColorToDefault();
-  setBackColorToDefault();
+  setForeColor(CO_DFT,DEFAULT_FORE_COLOR);
+  setBackColor(CO_DFT,DEFAULT_BACK_COLOR);
   cu_re   = DEFAULT_RENDITION;
   effectiveRendition();
 }
 
 /*!
 */
-
-void TEScreen::setForeColor(int fgcolor)
+void TEScreen::setForeColor(int space, int color)
 {
-  cu_fg = (fgcolor&7)+((fgcolor&8) ? 4+8 : 2);
+  cu_fg = cacol(space, color);
   effectiveRendition();
 }
 
 /*!
 */
-
-void TEScreen::setBackColor(int bgcolor)
-{
-  cu_bg = (bgcolor&7)+((bgcolor&8) ? 4+8 : 2);
-  effectiveRendition();
-}
-
-/*!
-*/
-
-void TEScreen::setBackColorToDefault()
-{
-  cu_bg = DEFAULT_BACK_COLOR;
-  effectiveRendition();
-}
-
-/*!
-*/
-
-void TEScreen::setForeColorToDefault()
+void TEScreen::setBackColor(int space, int color)
 {
-  cu_fg = DEFAULT_FORE_COLOR;
+  cu_bg = cacol(space, color);
   effectiveRendition();
 }
 
--- konsole/TEScreen.h.orig	2005-08-18 11:53:16.000000000 +0200
+++ konsole/TEScreen.h	2006-06-24 23:13:48.000000000 +0200
@@ -110,12 +110,11 @@
     //
     void setRendition  (int rendition);
     void resetRendition(int rendition);
-    void setForeColor  (int fgcolor);
-    void setBackColor  (int bgcolor);
+    //
+    void setForeColor  (int space, int color);
+    void setBackColor  (int space, int color);
     //
     void setDefaultRendition();
-    void setForeColorToDefault();
-    void setBackColorToDefault();
     //
     // -------------------------------------
     //
@@ -218,8 +217,8 @@
 
     // cursor color and rendition info
 
-    UINT8 cu_fg;      // foreground
-    UINT8 cu_bg;      // background
+    cacol cu_fg;      // foreground
+    cacol cu_bg;      // background
     UINT8 cu_re;      // rendition
 
     // margins ----------------
@@ -245,8 +244,8 @@
 
     // effective colors and rendition ------------
 
-    UINT8 ef_fg;      // These are derived from
-    UINT8 ef_bg;      // the cu_* variables above
+    cacol ef_fg;      // These are derived from
+    cacol ef_bg;      // the cu_* variables above
     UINT8 ef_re;      // to speed up operation
 
     //
@@ -261,8 +260,8 @@
     // rendition info
 
     UINT8 sa_cu_re;
-    UINT8 sa_cu_fg;
-    UINT8 sa_cu_bg;
+    cacol sa_cu_fg;
+    cacol sa_cu_bg;
     
     // last position where we added a character
     int lastPos;
--- konsole/TEWidget.cpp.orig	2005-08-18 11:53:16.000000000 +0200
+++ konsole/TEWidget.cpp	2006-06-24 23:21:38.000000000 +0200
@@ -586,7 +586,8 @@
                            QString& str, const ca *attr, bool pm, bool clear)
 {
   int a = font_a + m_lineSpacing / 2;
-  QColor fColor = printerFriendly ? Qt::black : color_table[attr->f].color;
+  QColor fColor = printerFriendly ? Qt::black : attr->f.color(color_table);
+  QColor bColor = attr->b.color(color_table);
   QString drawstr;
 
   if ((attr->r & RE_CURSOR) && !isPrinting)
@@ -595,7 +596,7 @@
   // Paint background
   if (!printerFriendly)
   {
-    if (color_table[attr->b].transparent)
+    if (attr->isTransparent(color_table))
     {
       if (pm)
         paint.setBackgroundMode( TransparentMode );
@@ -604,12 +605,12 @@
     }
     else
     {
-      if (pm || color_table[attr->b].color != color_table[ colorsSwapped ? \
                DEFAULT_FORE_COLOR : DEFAULT_BACK_COLOR ].color
-          || clear || (blinking && (attr->r & RE_BLINK)))
+      if (pm || clear || (blinking && (attr->r & RE_BLINK)) ||
+          attr->b == cacol(CO_DFT, colorsSwapped ? DEFAULT_FORE_COLOR : \
DEFAULT_BACK_COLOR) )  
         // draw background colors with 75% opacity
         if ( argb_visual && qAlpha(blend_color) < 0xff ) {
-          QRgb col = color_table[attr->b].color.rgb();
+          QRgb col = bColor.rgb();
 
           Q_UINT8 salpha = 192;
           Q_UINT8 dalpha = 255 - salpha;
@@ -625,7 +626,7 @@
 
           paint.fillRect(rect, QColor(col, pixel));
         } else
-          paint.fillRect(rect, color_table[attr->b].color);
+          paint.fillRect(rect, bColor);
     }
 
     QString tmpStr = str.simplifyWhiteSpace();
@@ -664,8 +665,8 @@
     {
        if (!cursorBlinking)
        {
-          paint.fillRect(r, color_table[attr->f].color);
-          fColor = color_table[attr->b].color;
+          paint.fillRect(r, fColor);
+          fColor = bColor;
        }
     }
     else
@@ -685,7 +686,7 @@
     bool shadow = false;
     paint.setPen(fColor);
     int x = rect.x();
-    if (color_table[attr->f].bold && printerBold)
+    if (attr->isBold(color_table) && printerBold)
     {
       // When printing we use a bold font for bold
       paint.save();
@@ -721,13 +722,13 @@
       paint.drawText(x,y, str, -1, bidiEnabled ? QPainter::Auto : QPainter::LTR );
     }
 
-    if (color_table[attr->f].bold && isPrinting)
+    if (attr->isBold(color_table) && isPrinting)
     {
       // When printing we use a bold font for bold
       paint.restore();
     }
 
-    if (color_table[attr->f].bold && !printerBold)
+    if (attr->isBold(color_table) && !printerBold)
     {
       paint.setClipRect(rect);
       // On screen we use overstrike for bold
@@ -796,9 +797,9 @@
   int    tLy = tL.y();
   hasBlinker = false;
 
-  int cf  = -1; // undefined
-  int cb  = -1; // undefined
-  int cr  = -1; // undefined
+  cacol cf;       // undefined
+  cacol cb;       // undefined
+  int   cr  = -1; // undefined
 
   int lins = QMIN(this->lines,  QMAX(0,lines  ));
   int cols = QMIN(this->columns,QMAX(0,columns));
@@ -1049,9 +1050,9 @@
          disstrU[p++] = c; //fontMap(c);
       bool lineDraw = isLineChar(c);
       bool doubleWidth = (image[loc(x,y)+1].c == 0);
-      int cf = image[loc(x,y)].f;
-      int cb = image[loc(x,y)].b;
-      int cr = image[loc(x,y)].r;
+      cacol cf = image[loc(x,y)].f;
+      cacol cb = image[loc(x,y)].b;
+      int   cr = image[loc(x,y)].r;
       while (x+len <= rlx &&
              image[loc(x+len,y)].f == cf &&
              image[loc(x+len,y)].b == cb &&
@@ -2009,10 +2010,10 @@
   // We initialize image[image_size] too. See makeImage()
   for (int i = 0; i <= image_size; i++)
   {
-    image[i].c = 0xff; //' ';
-    image[i].f = 0xff; //DEFAULT_FORE_COLOR;
-    image[i].b = 0xff; //DEFAULT_BACK_COLOR;
-    image[i].r = 0xff; //DEFAULT_RENDITION;
+    image[i].c = ' ';
+    image[i].f = cacol(CO_DFT,DEFAULT_FORE_COLOR);
+    image[i].b = cacol(CO_DFT,DEFAULT_BACK_COLOR);
+    image[i].r = DEFAULT_RENDITION;
   }
 }
 
--- konsole/TEmuVt102.cpp.orig	2006-05-16 01:11:01.000000000 +0200
+++ konsole/TEmuVt102.cpp	2006-06-24 23:12:46.000000000 +0200
@@ -344,6 +344,17 @@
     for (i=0;i<=argc;i++)
     if ( epp(     ))  { tau( TY_CSI_PR(cc,argv[i]),    0,   0); }
     else if(egt(    ))   { tau( TY_CSI_PG(cc     ),    0,   0); } // spec. case for \
ESC]>0c or ESC]>c +    else if (cc == 'm' && argc - i >= 4 && (argv[i] == 38 || \
argv[i] == 48) && argv[i+1] == 2) +    { // ESC[ ... 48;2;<red>;<green>;<blue> ... m \
-or- ESC[ ... 38;2;<red>;<green>;<blue> ... m +      i += 2;
+      tau( TY_CSI_PS(cc, argv[i-2]), CO_RGB, (argv[i] << 16) | (argv[i+1] << 8) | \
argv[i+2]); +      i += 2;
+    }
+    else if (cc == 'm' && argc - i >= 2 && (argv[i] == 38 || argv[i] == 48) && \
argv[i+1] == 5) +    { // ESC[ ... 48;5;<index> ... m -or- ESC[ ... 38;5;<index> ... \
m +      i += 2;
+      tau( TY_CSI_PS(cc, argv[i-2]), CO_256, argv[i]);
+    }
     else              { tau( TY_CSI_PS(cc,argv[i]),    0,   0); }
     resetToken();
   }
@@ -543,43 +554,49 @@
     case TY_CSI_PS('m',   25) : scr->resetRendition     (RE_BLINK    ); break;
     case TY_CSI_PS('m',   27) : scr->resetRendition     (RE_REVERSE  ); break;
 
-    case TY_CSI_PS('m',   30) : scr->setForeColor         (         0); break;
-    case TY_CSI_PS('m',   31) : scr->setForeColor         (         1); break;
-    case TY_CSI_PS('m',   32) : scr->setForeColor         (         2); break;
-    case TY_CSI_PS('m',   33) : scr->setForeColor         (         3); break;
-    case TY_CSI_PS('m',   34) : scr->setForeColor         (         4); break;
-    case TY_CSI_PS('m',   35) : scr->setForeColor         (         5); break;
-    case TY_CSI_PS('m',   36) : scr->setForeColor         (         6); break;
-    case TY_CSI_PS('m',   37) : scr->setForeColor         (         7); break;
-    case TY_CSI_PS('m',   39) : scr->setForeColorToDefault(          ); break;
-
-    case TY_CSI_PS('m',   40) : scr->setBackColor         (         0); break;
-    case TY_CSI_PS('m',   41) : scr->setBackColor         (         1); break;
-    case TY_CSI_PS('m',   42) : scr->setBackColor         (         2); break;
-    case TY_CSI_PS('m',   43) : scr->setBackColor         (         3); break;
-    case TY_CSI_PS('m',   44) : scr->setBackColor         (         4); break;
-    case TY_CSI_PS('m',   45) : scr->setBackColor         (         5); break;
-    case TY_CSI_PS('m',   46) : scr->setBackColor         (         6); break;
-    case TY_CSI_PS('m',   47) : scr->setBackColor         (         7); break;
-    case TY_CSI_PS('m',   49) : scr->setBackColorToDefault(          ); break;
-
-    case TY_CSI_PS('m',   90) : scr->setForeColor         (         8); break;
-    case TY_CSI_PS('m',   91) : scr->setForeColor         (         9); break;
-    case TY_CSI_PS('m',   92) : scr->setForeColor         (        10); break;
-    case TY_CSI_PS('m',   93) : scr->setForeColor         (        11); break;
-    case TY_CSI_PS('m',   94) : scr->setForeColor         (        12); break;
-    case TY_CSI_PS('m',   95) : scr->setForeColor         (        13); break;
-    case TY_CSI_PS('m',   96) : scr->setForeColor         (        14); break;
-    case TY_CSI_PS('m',   97) : scr->setForeColor         (        15); break;
-
-    case TY_CSI_PS('m',  100) : scr->setBackColor         (         8); break;
-    case TY_CSI_PS('m',  101) : scr->setBackColor         (         9); break;
-    case TY_CSI_PS('m',  102) : scr->setBackColor         (        10); break;
-    case TY_CSI_PS('m',  103) : scr->setBackColor         (        11); break;
-    case TY_CSI_PS('m',  104) : scr->setBackColor         (        12); break;
-    case TY_CSI_PS('m',  105) : scr->setBackColor         (        13); break;
-    case TY_CSI_PS('m',  106) : scr->setBackColor         (        14); break;
-    case TY_CSI_PS('m',  107) : scr->setBackColor         (        15); break;
+    case TY_CSI_PS('m',   30) : scr->setForeColor         (CO_SYS,  0); break;
+    case TY_CSI_PS('m',   31) : scr->setForeColor         (CO_SYS,  1); break;
+    case TY_CSI_PS('m',   32) : scr->setForeColor         (CO_SYS,  2); break;
+    case TY_CSI_PS('m',   33) : scr->setForeColor         (CO_SYS,  3); break;
+    case TY_CSI_PS('m',   34) : scr->setForeColor         (CO_SYS,  4); break;
+    case TY_CSI_PS('m',   35) : scr->setForeColor         (CO_SYS,  5); break;
+    case TY_CSI_PS('m',   36) : scr->setForeColor         (CO_SYS,  6); break;
+    case TY_CSI_PS('m',   37) : scr->setForeColor         (CO_SYS,  7); break;
+
+    case TY_CSI_PS('m',   38) : scr->setForeColor         (p,       q); break;
+
+    case TY_CSI_PS('m',   39) : scr->setForeColor         (CO_DFT,  0); break;
+
+    case TY_CSI_PS('m',   40) : scr->setBackColor         (CO_SYS,  0); break;
+    case TY_CSI_PS('m',   41) : scr->setBackColor         (CO_SYS,  1); break;
+    case TY_CSI_PS('m',   42) : scr->setBackColor         (CO_SYS,  2); break;
+    case TY_CSI_PS('m',   43) : scr->setBackColor         (CO_SYS,  3); break;
+    case TY_CSI_PS('m',   44) : scr->setBackColor         (CO_SYS,  4); break;
+    case TY_CSI_PS('m',   45) : scr->setBackColor         (CO_SYS,  5); break;
+    case TY_CSI_PS('m',   46) : scr->setBackColor         (CO_SYS,  6); break;
+    case TY_CSI_PS('m',   47) : scr->setBackColor         (CO_SYS,  7); break;
+
+    case TY_CSI_PS('m',   48) : scr->setBackColor         (p,       q); break;
+
+    case TY_CSI_PS('m',   49) : scr->setBackColor         (CO_DFT,  1); break;
+
+    case TY_CSI_PS('m',   90) : scr->setForeColor         (CO_SYS,  8); break;
+    case TY_CSI_PS('m',   91) : scr->setForeColor         (CO_SYS,  9); break;
+    case TY_CSI_PS('m',   92) : scr->setForeColor         (CO_SYS, 10); break;
+    case TY_CSI_PS('m',   93) : scr->setForeColor         (CO_SYS, 11); break;
+    case TY_CSI_PS('m',   94) : scr->setForeColor         (CO_SYS, 12); break;
+    case TY_CSI_PS('m',   95) : scr->setForeColor         (CO_SYS, 13); break;
+    case TY_CSI_PS('m',   96) : scr->setForeColor         (CO_SYS, 14); break;
+    case TY_CSI_PS('m',   97) : scr->setForeColor         (CO_SYS, 15); break;
+
+    case TY_CSI_PS('m',  100) : scr->setBackColor         (CO_SYS,  8); break;
+    case TY_CSI_PS('m',  101) : scr->setBackColor         (CO_SYS,  9); break;
+    case TY_CSI_PS('m',  102) : scr->setBackColor         (CO_SYS, 10); break;
+    case TY_CSI_PS('m',  103) : scr->setBackColor         (CO_SYS, 11); break;
+    case TY_CSI_PS('m',  104) : scr->setBackColor         (CO_SYS, 12); break;
+    case TY_CSI_PS('m',  105) : scr->setBackColor         (CO_SYS, 13); break;
+    case TY_CSI_PS('m',  106) : scr->setBackColor         (CO_SYS, 14); break;
+    case TY_CSI_PS('m',  107) : scr->setBackColor         (CO_SYS, 15); break;
 
     case TY_CSI_PS('n',    5) :      reportStatus         (          ); break;
     case TY_CSI_PS('n',    6) :      reportCursorPosition (          ); break;
--- tests/256colors.pl.orig	2006-06-24 20:11:51.000000000 +0200
+++ tests/256colors.pl	2006-06-24 20:14:08.000000000 +0200
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+# Author: Todd Larason <jtl@molehill.org>
+# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.1 1999/07/11 08:49:54 dawes \
Exp $ +
+# display back ground colors
+
+for ($fgbg = 38; $fgbg <= 48; $fgbg +=10) {
+
+# first the system ones:
+print "System colors:\n";
+for ($color = 0; $color < 8; $color++) {
+    print "\x1b[${fgbg};5;${color}m::";
+}
+print "\x1b[0m\n";
+for ($color = 8; $color < 16; $color++) {
+    print "\x1b[${fgbg};5;${color}m::";
+}
+print "\x1b[0m\n\n";
+
+# now the color cube
+print "Color cube, 6x6x6:\n";
+for ($green = 0; $green < 6; $green++) {
+    for ($red = 0; $red < 6; $red++) {
+	for ($blue = 0; $blue < 6; $blue++) {
+	    $color = 16 + ($red * 36) + ($green * 6) + $blue;
+	    print "\x1b[${fgbg};5;${color}m::";
+	}
+	print "\x1b[0m ";
+    }
+    print "\n";
+}
+
+
+# now the grayscale ramp
+print "Grayscale ramp:\n";
+for ($color = 232; $color < 256; $color++) {
+    print "\x1b[${fgbg};5;${color}m::";
+}
+print "\x1b[0m\n";
+
+}



_______________________________________________
konsole-devel mailing list
konsole-devel@kde.org
https://mail.kde.org/mailman/listinfo/konsole-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic