diff layer/ColourDatabase.cpp @ 1374:631897ba9fca zoom

Merge from default branch
author Chris Cannam
date Tue, 06 Nov 2018 08:59:03 +0000
parents f5566f7271fe
children ad86aa712d11
line wrap: on
line diff
--- a/layer/ColourDatabase.cpp	Fri Oct 05 10:25:52 2018 +0100
+++ b/layer/ColourDatabase.cpp	Tue Nov 06 08:59:03 2018 +0000
@@ -85,6 +85,26 @@
     return -1;
 }
 
+QColor
+ColourDatabase::getContrastingColour(int c) const
+{
+    QColor col = getColour(c);
+    if (col.red() > col.blue()) {
+        if (col.green() > col.blue()) {
+            return Qt::blue;
+        } else {
+            return Qt::yellow;
+        }
+    } else {
+        if (col.green() > col.blue()) {
+            return Qt::yellow;
+        } else {
+            return Qt::red;
+        }
+    }
+    return Qt::red;
+}
+
 bool
 ColourDatabase::useDarkBackground(int c) const
 {