Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SAPC support #35

Open
CoreyGinnivan opened this issue Apr 15, 2020 · 3 comments
Open

Add SAPC support #35

CoreyGinnivan opened this issue Apr 15, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@CoreyGinnivan
Copy link
Owner

https://github.com/Myndex/SAPC/tree/master/JS

@CoreyGinnivan CoreyGinnivan added the enhancement New feature or request label Apr 15, 2020
@CoreyGinnivan CoreyGinnivan self-assigned this Apr 15, 2020
@Myndex
Copy link

Myndex commented Nov 29, 2021

I expect to have an npm package soon. Also just as an FYI we're calling the basic free algorithm "APCA" now... SAPC is the full appearance model...

@Myndex
Copy link

Myndex commented Dec 5, 2021

APCA npm Package

The APCA npm package is now available: apca-w3

Install:

 npm i apca-w3

Usage:

And the API is trivially simple: send it two colors, it returns a signed INT of the Lc value (lightness contrast).

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

Implementation notes:

Color sent to the required parsing function sRGBtoY() can be a 3 or 6 character hex string #fff or a3b3d4 (hash # is optional but not required), a named CSS color (such as aquamarine), as rgb(99,122,14), or as a number 0x123456 or 15213412. Text color first, background color second — do not swap colors, as use case affects results. light text on a dark background returns a negative value.

For questions and comments please visit the main APCA repo discussion area.

Thank you!

Andy

@Myndex
Copy link

Myndex commented Jan 9, 2022

Hey @CoreyGinnivan I'm not sure if you are aware but we released Bridge-PCA which is backwards compatible with the old WCAG 2, but using APCA technology — if you pass Bridge-PCA you automatically pass WCAG 2.

Also available as an npm package:

 npm i bridge-pca

Thank you!

Andy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants