bestTextContrast
function bestTextContrast(hex): { color: "#000000" | "#FFFFFF"; passesAA: boolean; passesAALarge: boolean; ratio: number;};Defined in: packages/asset-client/src/palette.ts:145
Same choice as the recommended text colour, but it also returns the ratio it achieved and whether that passes AA — so a caller can decide with the number in front of them instead of assuming it was enough.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
hex |
string |
Returns
Section titled “Returns”{ color: "#000000" | "#FFFFFF"; passesAA: boolean; passesAALarge: boolean; ratio: number;}color: "#000000" | "#FFFFFF";passesAA
Section titled “passesAA”passesAA: boolean;passesAALarge
Section titled “passesAALarge”passesAALarge: boolean;ratio: number;