Temporary KColorScheme change - hard-code some state colors

Matthew Woehlke mw_triad at users.sourceforge.net
Tue Sep 4 20:54:36 BST 2007


I'm thinking I'd like to check in the following diff as a temporary 
measure to get people thinking about active vs. inactive widget states.

This is a TEMPORARY change (things will be configurable in 4.0-final as 
I've previously talked about; (1) for example), but will hopefully help 
shake people out of the KDE3 way of thinking where it was "ok" to not 
think about widget states w.r.t. the color scheme.

1: http://permalink.gmane.org/gmane.comp.kde.devel.core/45131

Index: colors/kcolorscheme.cpp
===================================================================
--- colors/kcolorscheme.cpp     (revision 707100)
+++ colors/kcolorscheme.cpp     (working copy)
@@ -25,6 +25,7 @@
  #include <kglobalsettings.h>
  #include <kcolorutils.h>

+#include <QtGui/QWidget>
  #include <QtGui/QColor>
  #include <QtGui/QBrush>

@@ -116,6 +117,21 @@
      // apply state adjustments
      if (state != QPalette::Active) {
          // TODO - now tweak all the colors based on the state!
+        // FIXME - this code is temporary, proof-of-concept
+        if (state == QPalette::Inactive) {
+            _colors.bg[0] = KColorUtils::darken(_colors.bg[0], 0.3);
+            _colors.bg[1] = KColorUtils::darken(_colors.bg[1], 0.3);
+            _colors.deco[0] = KColorUtils::darken(_colors.deco[0], 0.3);
+            _colors.deco[1] = KColorUtils::darken(_colors.deco[1], 0.3);
+            for (int i=0; i<7; i++) {
+                _colors.fg[i] = KColorUtils::darken(_colors.fg[i], 0.3);
+            }
+        }
+        else {
+            for (int i=0; i<7; i++) {
+                _colors.fg[i] = KColorUtils::mix(_colors.fg[i], 
_colors.bg[0], 0.7);
+            }
+        }
      }

      // calculated backgrounds


-- 
Matthew
When in doubt, duct tape!





More information about the kde-core-devel mailing list