Home GnuPG

Improve heuristic for detecting of light high-constrast themes

Description

Improve heuristic for detecting of light high-constrast themes

Check the perceived lightness of the background color to detect light
high-constrast themes instead of checking for white background. In
Windows 11 the "Desert" high-contrast theme doesn't seem to use white
as background color. Moreover, the users can specify their own colors.

I chose to use the relative luminance defined in Rec. 709 for HDTV as
reasonable estimate of the perceived lightness. I'm ignoring gamma
correction (and more complicated color spaces like CIELAB) and the
threshold 0.5 for a light theme is arbitrarily chosen. I assume that's
okay since we are dealing with _high-constrast_ themes which should
either use a very light or a very dark background color.