APCA

MYNDEX
RESEARCH

APCA

⇦ HOME ⇧ UP ONE


APCA The Revolution Will Be Readable

version    downloads    last commit   
license    twitter    CSS level 3


APCA • SAPC • SACAM PRIMARY REPOSITORY

Please make all comments or discussions here and not in the satellite repositories.

Accessible Perceptual Contrast Algorithm

(Formerly the Advanced Perceptual Contrast Algorithm)

Source and Data

DOCUMENTATION

Simple Overview, QuickStart, and FAQ

These are intended for end users, and those interested in a plain language overview without a lot of the math & theory.

Sciencey Stuff!

Maths! Vision Science! Photons on Parade!

For Developers

THIS REPOSITORY, and apca-w3 ARE THE ONLY CANONICAL SOURCES OF APPROVED APCA CODE.

Bridge PCA

Do you want to improve readability, but you are forced to used WCAG 2 contrast to the letter? Then Bridge PCA is for you. It is backward compatible with WCAG 2, but using APCA technology. SEE: Bridge PCA Repository

W3 Licensed Files Moved

All files that are part of and licensed to the W3 and AGWG, in support of WCAG 3, are now in their own repository.

SEE: APCA W3 Repository and please source all files for tools intended for WCAG 3 conformance from that specific repository. The files in this repositiory are part of other projects, and not necessary for WCAG 3 compliance.


Got Questions? We Got Answers!

Please feel free to use the discussion area for any questions or comments.

Why APCA

See WHY APCA for a brief plain language explanation of the important differences of APCA for WCAG 3 vs the old WCAG 2.x/1.4.3 contrast guidelines.

SAPC and APCA demo tools are live to play with.

The basic simple version is the APCA page, it includes the new scaling and the dynamic font matrix. The is the official WCAG3/Silver support version.

The development version is the SAPC page, and this version includes the new RESEARCH MODE, which has some different tools you can activate to investigate the nature of a color or colors, including a simplified version of the middle contrast experiment - on the SAPC app it’s called “split contrast mode”.

APCA is the Accessible Perceptual Contrast Algorithm

APCA is a set of contrast assessment methods for predicting perceived contrast between sRGB colors on a computer monitor. It has been developed as an assessment method for W3 Silver/WCAG3 accessibility standards relating to content for computer displays and mobile devices.

BASIC FEATURES


LIVE VERSION

There is a working version with examples and reference material on APCA site


Font Use Lookup Tables

Latest Lookup Table: May 27 2022

APCA Lookup Table

APCA Lookup table legend

APCA Lookup Table


THIS REPOSITORY, and apca-w3 ARE THE ONLY CANONICAL SOURCES OF APPROVED APCA CODE.

If you are integrating code, please check here for official changes, or at apca-w3 for the W3 licensed version. This code is considered beta, and will change periodically. The repo for WCAG_3 compliance is apca-w3.

Files with RESEARCH or DEV in the name are part of ongoing research and should NOT be used for developing conformance tools, and further are not licensed for use in distributed software, and should be considered experimental only.

NOTICE: There are some obsolete code listings on some legacy working drafts of Silver aka WCAG 3. **These should not be used and are not compatible with the current or future versions. If you developed code around these please let us know! We can help facilitate transitioning to the correct code and constants.**

IMPLEMENTATIONS

The base libraries are plain vanilla Javascript. Other languages may be in the “PORTS” folder. Many of the available inputs to the functions can remain at their defaults, though these extra inputs can be used in more specialized situations (such as creating content specifically for daylight/outdoors, or specifically for dark nights, etc.).

A plain language walkthrough, LaTeX math, and related supporting information is below:

APCA 0.1.9 4g constants and math

APCA is the Accessible Perceptual Contrast Algorithm. The math below assumes the use of the web standard sRGB colorspace.

 // 0.98G-4g full range version constants:
    
  Exponents =  { mainTRC: 2.4,       normBG: 0.56,       normTXT: 0.57,     revTXT: 0.62,     revBG: 0.65, };
  
  ColorSpace = { sRco: 0.2126729,    sGco: 0.7151522,    sBco: 0.0721750, };
    
  Clamps =     { blkThrs: 0.022,     blkClmp: 1.414,     loClip: 0.001,     deltaYmin: 0.0005, };
        
  Scalers =    { scaleBoW: 1.14,     loBoWthresh: 0.035991,  loBoWfactor: 27.7847239587675,  loBoWoffset: 0.027, 
                 scaleWoB: 1.14,     loWoBthresh: 0.035991,  loWoBfactor: 27.7847239587675,  loWoBoffset: 0.027, };	

The Plain English Steps Are:


Basic APCA Math in LaTeX

0.0.98G-4g-base W3 (apca-w3 0.1.17)

NOTICE: “APCA is a method for predicting text contrast on self-illuminated displays for web-based content. Some use-cases are prohibited by license, including the following: use in medical, clinical evaluation, human safety related, aerospace, transportation, military applications, are strictly prohibited without a specific license in writing granting such use.”


TESTING YOUR IMPLEMENTATION

If you’ve implemented the code and want a quick sanity check, Here are some keystone checks with no rounding. The first color is TEXT and the second color is BACKGROUND:

Test Values for APCA W3 using the G series constants, normal and reverse float values for each color pair.
First number is TEXT second number is BACKGROUND.

    TEXT vs BKGND •  EXPECTED RESULT for APCA W3 to 0.1.9 (G-constants)

    #888 vs #fff  •  63.056469930209424
    #fff vs #888  • -68.54146436644962  

    #000 vs #aaa  •  58.146262578561334
    #aaa vs #000  • -56.24113336839742
    
    #123 vs #def  •  91.66830811481631
    #def vs #123  • -93.06770049484275

    #123 vs #444  •   8.32326136957393
    #444 vs #123  •  -7.526878460278154

The below are only for certain experimental low-scale versions, these tests do *not* acpa-w3:
    #123 vs #234  •   1.7512243099356113
    #234 vs #123  •  -1.6349191031377903

These exercise all the important constants.



Miscellaneous

THIS IS BETA

Being developed for use with future web standards for accessibility. Those standards are under separate repositories with the W3/AGWG.

OTHER RESOURCES

The Myndex APCA Linktree

The Myndex Color and Contrast Resource Page

Visual Contrast Subgroup Wiki

The author’s website includes further background, including select experimental results and white-papers


DISCLAIMER

DISCLAIMER AND LIMITATIONS OF USE:
APCA is an embodiment of certain supra-threshold contrast
prediction technologies. Versions marked as licensed to
the W3 are strictly limited to web content use only for
supporting certain accessibility guidelines.

APCA code listed here is provided as is, with no
warrantees expressed nor implied. We accept no
liability for any use or misuse of the code.
Suitability of purpose resides with the
integrator or end user.

Commercial use is prohibited without a written
and signed commercial license agreement.

Non-commercial use is permitted only for
predicting contrast for web content, no
other use case is authorized.

License excludes other use cases not related to web
content. Prohibited uses include and are not limited
to medical, clinical evaluation, human safety related,
aerospace, transportation, military applications, and
uses which are not specific to web-based content
presented on self-illuminated displays or devices.


Glossary


Change Notices:

If you have been using any files from this repository, be sure to read the file “ImportantChangeNotices.md” for critical updates that may affect results.

SAPC/APCA CURRENT VERSION: 0.1.9 Constants: 0.0.98G-4g

January 27 2022

Font lookup table revised, now LUT ver 0.1.5 G constants. New the arrays in the data folder. More uniform response across multiple font families, and improved acuity weighting.

January 18 2022

Font lookup table revised, still for 4G constants. Tighter conformance now.

January 2 2022

Font lookup table revised, still for 4G constants.

December 1, 2021

All W3 licensed files moved to their own repository, AND
A new npm package has been released (of the W3 version) to ease integration!!

November 23, 2021

Adopting semantic versioning, adding a first 0. so the current version is 0.0.98G

November 17, 2021

Please see the new font lookup table (LUT3) (on this page, below)

October 1, 2021

The base APCA with the 0.0.98G-4g constants is in the JS folder.

NEW CONSTANTS and NEW MATH:

(October 1, 2021) the 0.0.98G-4g math and constants have been in use now for months, and by all accounts are working well as expected. The revised code is available in the JS folder. The present version improves tracking of contrast perception. (Doubling or halving the Lc value results in a perceived doubling or halving of contrast.) Also, smoother results for low contrasts and dark color pairs.



Accessibility Statement for Beta Sites

At their option, beta testers, early adopters, and sites using APCA to determine text and non-text contrast may wish to include the following statement in their site’s boilerplate:


APCA Accessibility Statement v0.1.9

This website is beta testing the APCA guidelines for determining text and non-text contrast. It is well known that WCAG 2 contrast maths and methods are not accurate regarding human perception of text, as a result automated testing using WCAG 2 maths may incorrectly indicate errors in some color pairs on this site. The APCA guidelines are a substantial improvement in accessibility over WCAG 2 contrast criterions, and therefore compliant with the ADA. Compliance with US Access Board 508 rules is per the alternative methods section. Compliance in other jurisdictions subject to evaluation. Any automated testing done to determine conformance of this site must be conducted using a perceptually accurate method of predicting text contrast, such as APCA. WCAG 2.x math, methods, and success criterion are notwithstanding.

This Site is Tested With APCA-W3 Version: < insert valid guidelines version here >

End Accessibility Statement


For giggles:

More glossary of confusing terms and “bonus sciencey stuff” in The Lighter Side of Light

THE REVOLUTION WILL BE READABLE

APCA The Revolution Will Be Readable


Disclaimer: APCA is being evaluated as a replacement for WCAG 2 contrast math for future standards and guidelines, however, standards that will be incorporating APCA are still developmental. Because WCAG 2 contrast math does not accurately model human visual perception nor visual impairments, there will be discrepancies between WCAG 2 contrast math, and perceptually uniform models such as APCA. It is up to the end user to determine suitability of purpose for their region and conformance requirements.

⇦ HOME ⇧ UP ONE