mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Make it more likely that we pick a dark contrast color from RiaColorTools
This commit is contained in:
parent
7a275be335
commit
1c780deeab
@ -28,10 +28,11 @@
|
|||||||
/// Uses W3.org relative luminance calculation taking into account the different luminance of the different colors
|
/// Uses W3.org relative luminance calculation taking into account the different luminance of the different colors
|
||||||
/// https://www.w3.org/TR/WCAG20-TECHS/G18.html
|
/// https://www.w3.org/TR/WCAG20-TECHS/G18.html
|
||||||
/// Luminance is between [0, 1] so anything above 0.5 is considered in the bright half of the spectrum.
|
/// Luminance is between [0, 1] so anything above 0.5 is considered in the bright half of the spectrum.
|
||||||
|
/// However, subjectively the contrast looks better if the threshold is to 0.4 so black contrast is used a bit more often.
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RiaColorTools::isBrightnessAboveThreshold(cvf::Color3f backgroundColor)
|
bool RiaColorTools::isBrightnessAboveThreshold(cvf::Color3f backgroundColor)
|
||||||
{
|
{
|
||||||
if (relativeLuminance(backgroundColor) > 0.5)
|
if (relativeLuminance(backgroundColor) > 0.4)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user