An open API service indexing awesome lists of open source software.

https://github.com/myndex/max-contrast

Send it the background color, returns black or white whichever is maximum Lc value
https://github.com/myndex/max-contrast

apca color contrast contrast-enhancement contrast-ratio css wcag web-colors

Last synced: 14 days ago
JSON representation

Send it the background color, returns black or white whichever is maximum Lc value

Awesome Lists containing this project

README

        


maxContrast() Badges

license 
last commit 
plain vanilla JS 
twitter 

APCA Project Badges

CVD Simulator 
APCA Resources 
SAPC/Main Repo 
APCA/Live Tool/ 

# maxContrast()
Send it the background color, it returns a black or white text color, whichever is maximum APCA Lc value

```JS
// Version in maxContrastArray.js
let color = maxContrast([0xce,0x96,0x99])
console.log(color); // [0,0,0]

```
```JS

// Version in maxContrastString.js
let color = maxContrast(119,127,206)
console.log(color); // 'white'

```

This is part of the [APCA contrast project](https://github.com/Myndex/SAPC-APCA).

## Files
- `/src/maxContrastArray.js` send an RGB array, it returns an RGB array, suitable for use with [ColorParsley](https://github.com/Myndex/colorparsley)

- `/src/maxContrastString.js` send R G and B ints, it returns a color string.

### Related Resources
- [Fancy Font Flipping](https://github.com/Myndex/fancyfontflipping) experimental demonstrator showing the ideas behind this.
- [APCA Linktree](https://linktr.ee/Myndex) Curated quick-start documentation for APCA
- [APCA Documentation Repo](https://github.com/Myndex/SAPC-APCA) Main APCA docs
- [APCA Readability Criterion](https://readtech.org/ARC/) public working draft
- [apca-w3](https://github.com/Myndex/apca-w3) public APCA for W3 and WCAG 3
- [ColorParsley](https://github.com/Myndex/colorparsley) lightweight micro-library for parsing colors

License is modified GNU 3.

 an image of mad max racing through the desert and behind them are the letters MAX and under that is the word contrast
Copyright © 2023 by Andrew Somers. All Rights Reserved.