W3C home > Mailing lists > Public > w3c-wai-ig@w3.org > October to December 2012

Re: Color contrast between semi-transparent colors

From: Simon Sapin <simon.sapin@kozea.fr>
Date: Mon, 29 Oct 2012 07:58:59 +0100
Message-ID: <508E2933.1030403@kozea.fr>
To: Lea Verou <lea@w3.org>
CC: w3c-wai-ig@w3.org, Chris Lilley <chris@w3.org>, Shadi Abou-Zahra <shadi@w3.org>
Le 29/10/2012 00:14, Simon Sapin a écrit :
> We do want something "close" to the text color, but in luminance space,
> more or less.

I went a bit too fast and did not prove this.

> You already proved the bounds of the luminance for the
> background blended on its backdrop: they are reached when the backdrop
> is black or white. We only need to the background luminance closest to
> the text’s, but within these bounds.

The contrast ratio of two luminance values is defined as:

   C(L_a, L_b) = (L1 + 0.05) / (L2 + 0.05)
   L1 = max(L_a, L_b)
   L1 = min(L_a, L_b)

Now let’s consider C(L) = C(L, L_text) the contrast between a variable 
blended background lumimance L and a fixed text luminance L_text. We are 
trying to minimize C(L)

* At L = L_text, C(L) = 1 with both "legs" (C is continuous.)
* For L > L_text, C(L) is affine with positive coefficient and is 
therefore strictly increasing.
* For L < L_text, C(L) is the inverse of a strictly increasing affine, 
and is therefore strictly decreasing.

Therefore, L = L_text is the absolute minimum of C(L) and a smaller 
abs(L - L_text) ("distance" in luminance space) implies a smaller C(L) 
(smaller contrast ratio)

> If the text luminance*is*  within these bounds, the minimal contrast is
> 1:1. Otherwise it is either higher than both (minimal contrast is
> obtained on a white backdrop) or lower then both (minimal contrast is
> obtained on a black backdrop)

Simon Sapin
Received on Monday, 29 October 2012 06:59:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 20:36:42 UTC