private static double getLuminance(final int r, final int g, final int b) {
        final double[] components = {r / 255.0, g / 255.0, b / 255.0};
        for (int i = 0; i < components.length; i++) {
            if (components[i] <= 0.03928) {
                components[i] /= 12.92;
            } else {
                components[i] = Math.pow((components[i] + 0.055) / 1.055, 2.4);
            }
        }
        return components[0] * 0.2126 + components[1] * 0.7152 + components[2] * 0.0722;
    }
Calculates color luminance according to W3 standard
<p>
<a href="https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef">...</a>
main/src/main/java/cgeo/geocaching/utils/ColorUtils.java