/max-contrast

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

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

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

        // 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.

Files

  • /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.

Related Resources

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.