]> granicus.if.org Git - nethack/commitdiff
Qt status bit
authorPatR <rankin@nethack.org>
Sun, 22 Nov 2020 09:10:52 +0000 (01:10 -0800)
committerPatR <rankin@nethack.org>
Sun, 22 Nov 2020 09:10:52 +0000 (01:10 -0800)
When Qt highlights a field that has gotten better, use the same
shade of green as is used for the green range of hitpoint bar.
The old value was too dull, like olive green seen in shadow.

win/Qt/qt_icon.cpp

index 19763cffb705a397405dcd0019dca30301df4f40..b32ac0d9a0b8e37040112857d0d62de88f7cd84f 100644 (file)
@@ -62,12 +62,18 @@ NetHackQtLabelledIcon::NetHackQtLabelledIcon(QWidget *parent, const char *l,
     initHighlight();
 }
 
+// set up the style sheet strings used to specify color for status field
+// labels [done "once", but once for each LabelledIcon that's constucted,
+// so more than 20 copies overall]
 void NetHackQtLabelledIcon::initHighlight()
 {
-    // note: string "green" is much darker than Qt::green
-    hl_better = "QLabel { background-color : green ; color : white }";
-    hl_worse  = "QLabel { background-color : red   ; color : white }";
-    hl_changd = "QLabel { background-color : blue  ; color : white }";
+    // note: string "green" is much darker than enum Qt::green
+    // QColor("green")              => #00ff00
+    // QColor(Qt::green)            => #008000
+    // QColor("green").lighter(150) => #00c000  /* hitpoint bar's green */
+    hl_better = "QLabel { background-color : #00c000 ; color : white }";
+    hl_worse  = "QLabel { background-color : red     ; color : white }";
+    hl_changd = "QLabel { background-color : blue    ; color : white }";
 }
 
 void NetHackQtLabelledIcon::setLabel(const QString &t, bool lower)