APCA Script Test

Usage:

First color must be text, second color must be the background.

APCAcontrast() requires Ys (display luminance)
sRGBtoY() requires an sRGB color array
displayP3toY() requires a displayP3 RGB color array
colorParsley() takes anything and parses it to an RGB color array

Lc = APCAcontrast(sRGBtoY(textColor),sRGBtoY(backgroundColor));
Enable Javascript

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 the 0.0.98G 4g constants, normal and reverse float values for each color pair.

First number is TEXT second number is BACKGROUND.

TEXT vs BKGND • EXPECTED RESULT for 0.1.0 and 0.0.98 G-4g

    #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
    #234 vs #444  •  -7.526878460278154
    
These exercise all the important constants.