Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/apca-w3.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,13 +432,17 @@ export function calcAPCA (textColor, bgColor, places = -1, round = true) {
// Note that this function requires colorParsley !!
let bgClr = colorParsley(bgColor);
let txClr = colorParsley(textColor);
return calcAPCAFromRGBA(txClr, bgClr, places, round);
} // End calcAPCA()

////////// ƒ calcAPCAFromRGBA() /////////////////////////////////////////////
export function calcAPCAFromRGBA (txClr, bgClr, places = -1, round = true) {
let hasAlpha = (txClr[3] == '' || txClr[3] == 1) ? false : true ;

if (hasAlpha) { txClr = alphaBlend( txClr, bgClr, round); };

return APCAcontrast( sRGBtoY(txClr), sRGBtoY(bgClr), places)
} // End calcAPCA()

} // End calcAPCAFromRGBA()



Expand Down