Classes
Methods
-
<inner> calculateContrastRatio(fgColor, bgColor) → {number}
-
Calculate the contrast ratio between the two given colors. Returns the ratio to 1, for example for two two colors with a contrast ratio of 21:1, this function will return 21.
Parameters:
Name Type Description fgColorColor the foreground color. bgColorColor the background color. Returns:
- Type
- number
-
<inner> flattenColors(fgColor, bgColor) → {Color}
-
Combine the two given colors according to alpha blending.
Parameters:
Name Type Description fgColorColor the foreground color. bgColorColor the background color. Returns:
- Type
- Color
-
<inner> suggestColors(bgColor, fgColor, desiredContrastRatios) → {Object.<string, string>}
-
Suggests alternative color suggestions to meet a given contrast ratio.
Parameters:
Name Type Description bgColorColor the background color. fgColorColor the foreground color. desiredContrastRatiosObject.<string, number> A map of label to desired contrast ratio. Returns:
- Type
- Object.<string, string>