aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/ThemeModern.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/gui/ThemeModern.cpp b/gui/ThemeModern.cpp
index 9b7df9ed59..8452c8a37d 100644
--- a/gui/ThemeModern.cpp
+++ b/gui/ThemeModern.cpp
@@ -1454,6 +1454,10 @@ OverlayColor ThemeModern::calcLuminance(OverlayColor col) {
uint8 r, g, b;
_system->colorToRGB(col, r, g, b);
+ // A better (but slower) formula to calculate the luminance would be:
+ //uint lum = (byte)((0.299 * r + 0.587 * g + 0.114 * b) + 0.5);
+ // Note that the approximation below will only produce values between
+ // (and including) 0 and 221.
uint lum = (r >> 2) + (g >> 1) + (b >> 3);
return _system->RGBToColor(lum, lum, lum);