ThePacielloGroup / CCAe

The Colour Contrast Analyser (CCA) helps you determine the legibility of text and the contrast of visual elements, such as graphical controls and visual indicators.
http://www.paciellogroup.com/resources/contrastanalyser/
GNU General Public License v3.0
468 stars 105 forks source link

For contrast just below the threshold, "Copy results" gives a contradictory number #300

Closed mitchellevan closed 10 months ago

mitchellevan commented 1 year ago

Describe the bug

When the CCA window says "Contrast ratio just below 4.5:1", copying the results to the clipboard says "Contrast ratio: 4.5:1".

The difference between "just below 4.5:1" and "4.5:1" is the difference between failing and passing, so this is a significant difference. Furthermore, the clipboard text contradicts itself by saying "Contrast ratio: 4.5:1" followed by "Fail for regular text".

Example of clipboard text:

Foreground: #777777
Background: #FFFFFF
Contrast ratio: 4.5:1
1.4.3 Contrast (Minimum) (AA)
    Pass for large text only. Fail for regular text
1.4.6 Contrast (Enhanced) (AAA)
    Fail for large and regular text
1.4.11 Non-text Contrast (AA)
    Pass for UI components and graphical objects

A similar problem occurs for a contrast ratio "just below 3:1 (2.995:1)". Example of clipboard text:

Foreground: #959595
Background: #FFFFFF
Contrast ratio: 3:1
1.4.3 Contrast (Minimum) (AA)
    Fail for large and regular text
1.4.6 Contrast (Enhanced) (AAA)
    Fail for large and regular text
1.4.11 Non-text Contrast (AA)
    Fail for UI components and graphical objects

Desktop (please complete the following information):

To Reproduce

  1. Using the eyedropper or direct entry, enter a pair of colors which differ by just under 4.5:1. Example: #777777 and #FFFFFF
  2. In the CCA window, observe the contrast ratio reported. Example: "Contrast ratio just below 4.5:1 (4.478:1)"
  3. In the "Edit" menu, select "Copy results" (or press CTRL + SHIFT + C) to copy results to the clipboard.
  4. Paste the results outside of CCA.
  5. In the pasted results, observe the contrast ratio reported.

Expected behavior

The contrast ratio reported at step 2 should be the same as the contrast ratio reported at step 5.

How to format it in the clipboard:

Note: When the CCA window shows a result rounded to one decimal place (e.g., "Contrast ratio 4.4:1"), the same rounded result should continue to appear in the clipboard ("Contrast ratio: 4.4:1") as it does today.

Screenshots

Step 2 in steps to reproduce:

Colour Contrast Analyser window showing the contrast between #777777 and #FFFFFF

Additional context

Understanding SC 1.4.3 Contrast (Minimum):

When comparing the computed contrast ratio to the Success Criterion ratio, the computed values should not be rounded (e.g. 4.499:1 would not meet the 4.5:1 threshold).

ferllings commented 10 months ago

Fixed on 37fc9a68cc11d010012ce695e6fdd9b365127e25