[Konsole-devel] colour changing per instance.

Alexander Kellett kelletta at eidetica.com
Sun Mar 10 00:40:12 UTC 2002


Here's a stupid little patch to allow hsv values in schemas
with -1 for the hue indicating that it should be random. 
The patched BlackOnLightYellow schema makes use of this, 
so that each terminal is a "LightRandomColour".

I'll do a better patch for 3.0.1 / 3.1 to allow random
colours per session rather than just instance of konsole.
But this is only a 15 min hack and might be of interest to
someone...

cheers,
Alex

btw: i'm not on the list

-- 
Eidetica                                                  Alexander Kellett
Kruislaan 400                                       [kelletta at eidetica.com]
NL 1098 SM Amsterdam                           tel +31 20 888 4125 fax 4001
http://www.eidetica.com/                          Client Solution Developer

vim: tw=70 cindent!
-------------- next part --------------
Index: konsole/schema.cpp
===================================================================
RCS file: /home/kde/kdebase/konsole/konsole/schema.cpp,v
retrieving revision 1.45
diff -u -r1.45 schema.cpp
--- konsole/schema.cpp	2001/12/15 21:59:49	1.45
+++ konsole/schema.cpp	2002/03/10 00:38:22
@@ -345,6 +345,22 @@
   m_tr_g=rg;
   m_tr_b=rb;
       }
+      if (!strncmp(line,"hsvcl",5))
+      { int fi,cr,cg,cb,tr,bo;
+        if(sscanf(line,"hsvcl %d %d %d %d %d %d",&fi,&cr,&cg,&cb,&tr,&bo) != 6)
+          continue;
+        if (!(0 <= fi && fi <= TABLE_COLORS)) continue;
+        if (!(-1 <= cr && cr <= 359        )) continue;
+        if (cr == -1) cr = KApplication::random()%359;
+        if (!(0 <= cg && cg <= 255         )) continue;
+        if (!(0 <= cb && cb <= 255         )) continue;
+        if (!(0 <= tr && tr <= 1           )) continue;
+        if (!(0 <= bo && bo <= 1           )) continue;
+        m_table[fi].color       = QColor();
+        m_table[fi].color.setHsv(cr,cg,cb);
+        m_table[fi].transparent = tr;
+        m_table[fi].bold        = bo;
+      }
       if (!strncmp(line,"color",5))
       { int fi,cr,cg,cb,tr,bo;
         if(sscanf(line,"color %d %d %d %d %d %d",&fi,&cr,&cg,&cb,&tr,&bo) != 6)
Index: other/BlackOnLightYellow.schema
===================================================================
RCS file: /home/kde/kdebase/konsole/other/BlackOnLightYellow.schema,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 BlackOnLightYellow.schema
--- other/BlackOnLightYellow.schema	1998/10/28 05:22:38	1.1.1.1
+++ other/BlackOnLightYellow.schema	2002/03/10 00:38:22
@@ -14,7 +14,7 @@
 #      V V--color--V  V V
 
 color  0   0   0   0  0 0  # regular   foreground color (Black)
-color  1 255 255 221  1 0  # regular   background color (Light Yellow)
+hsvcl  1  -1  30 255  1 0  # regular   background color (Light Yellow)
 
 color  2   0   0   0  0 0  # regular   color 0 Black
 color  3 178  24  24  0 0  # regular   color 1 Red


More information about the konsole-devel mailing list