https://bugs.documentfoundation.org/show_bug.cgi?id=156182

            Bug ID: 156182
           Summary: FORMATTING  Automatic text color can be unreadable
                    with darker cell colors
           Product: LibreOffice
           Version: Inherited From OOo
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

Description:
When the text color is set the automatic, the colors for text are frequently
illegible with darker cell backgrounds. At present, the text color flips from
black to white only when the cell is darker than about #3f3f3f.

For accessible contrast for readability, the central contrast point is much
higher, approximately #a4a4a4. 

I have an example image showing the current LibreOffice flip point, and then
APCA, luminance at 36Y, and the old WCAG2:

https://www.myndex.com/PUB/IMG/libreofficetextproblem.png
Will attach here as well

As you can see on the image the current flip point is too dark. Either APCA or
a simple luminance flip point at 0.36Y brings the contrast to ~perceptual
center.

NOTE: WCAG 2 math also fails for dark colors, and is not fit for use here, as
can also be seen on the example.

Assuming sRGB, the following simple code will take eight bit RGB values and
convert to a relative luminance value, that then can be used to determine the
flip point.


```
          // ANDY'S DOWN AND DIRTY LUMINANCEā„¢
         // Rs Gs Bs are 0-255 sRGB values. JS shown.
        // FlipY is a value 0.0-1.0, and 0.36 is a good point to flip text
black or white.
       // For purists: Yea this is NOT the IEC piecewise, but it's fast and
simple

    let flipY =
(Rs/255.0)**2.2*0.2126+(Gs/255.0)**2.2*0.7152+(Bs/255.0)**2.2*0.0722; 

```



Steps to Reproduce:
1. Set text color to automatic
2. Set the cell color to a very dark color but is lighter than about #3f3f3f
3. Some example cell backgrounds are #6d3400, #444, #005682
4. This is an accessibility fail but it is also a failure for all users as text
becomes essentially unreadable.

Actual Results:
Unreadable with insufficient contrast and too dark

Expected Results:
Ideally text should be readable in most cases. The simplest answer, the text
should flip from black to white or vice versa, when the luminance of the cell
color is approximately 0.36Y   

There is a demonstrator repo with links to examples and discussion:
https://github.com/Myndex/fancyfontflipping


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Version: 7.5.3.2 (X86_64) / LibreOffice Community
Build ID: 9f56dff12ba03b9acd7730a5a481eea045e468f3
CPU threads: 8; OS: Mac OS X 10.15.7; UI render: default; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to