changeset 291:3801289761a1

* dark background if necessary in key/mouse reference
author Chris Cannam
date Mon, 16 Jul 2007 14:06:03 +0000
parents 3101c68a00c1
children 24fc90078754
files widgets/KeyReference.cpp
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/widgets/KeyReference.cpp	Fri Jul 13 15:54:17 2007 +0000
+++ b/widgets/KeyReference.cpp	Mon Jul 16 14:06:03 2007 +0000
@@ -111,8 +111,12 @@
     }
 
     QString text;
+    
+    QColor bgcolor = QApplication::palette().window().color();
+    bool darkbg = (bgcolor.red() + bgcolor.green() + bgcolor.blue() < 384);
 
-    text += "<center><table bgcolor=\"#e8e8e8\">";
+    text += QString("<center><table bgcolor=\"%1\">")
+        .arg(darkbg ? "#121212" : "#e8e8e8");
         
     for (CategoryList::iterator i = m_categoryOrder.begin();
          i != m_categoryOrder.end(); ++i) {
@@ -120,7 +124,7 @@
         QString category = *i;
         KeyList &list = m_map[category];
 
-        text += QString("<tr><td bgcolor=\"#d0d0d0\" colspan=3 align=\"center\"><br><b>%1</b><br></td></tr>\n").arg(category);
+        text += QString("<tr><td bgcolor=\"%1\" colspan=3 align=\"center\"><br><b>%2</b><br></td></tr>\n").arg(darkbg ? "#303030" : "#d0d0d0").arg(category);
 
         for (KeyList::iterator j = list.begin(); j != list.end(); ++j) {