Send it the background color, it returns a black or white text color, whichever is maximum APCA Lc value
// Version in maxContrastArray.js
let color = maxContrast([0xce,0x96,0x99])
console.log(color); // [0,0,0]
// Version in maxContrastString.js
let color = maxContrast(119,127,206)
console.log(color); // 'white'
This is part of the APCA contrast project.
-
/src/maxContrastArray.js
send an RGB array, it returns an RGB array, suitable for use with ColorParsley -
/src/maxContrastString.js
send R G and B ints, it returns a color string.
- Fancy Font Flipping experimental demonstrator showing the ideas behind this.
- APCA Linktree Curated quick-start documentation for APCA
- APCA Documentation Repo Main APCA docs
- APCA Readability Criterion public working draft
- apca-w3 public APCA for W3 and WCAG 3
- ColorParsley lightweight micro-library for parsing colors
License is modified GNU 3.
Copyright © 2023 by Andrew Somers. All Rights Reserved.