Skip to content

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

License

Notifications You must be signed in to change notification settings

Myndex/max-contrast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Topics

Resources

License

Stars

Watchers

Forks