AbstractStaticapcaCalculates the APCA (Advanced Perceptual Contrast Algorithm) value. Returns a value Lc between ~ -108 and +106.
The score.
StaticapcaReturns font size requirements based on the APCA score. APCA couples contrast with font weight and size (unlike WCAG 2.1).
The score.
The reequirements.
StaticapcaGet a human friendly string representing the score.
The score.
The string.
StaticcontrastStaticgetReturns the color (c1 or c2) that provides the highest contrast against the background. Uses APCA by default for perceptual accuracy, but falls back to WCAG 2.1 if specified.
The color with the best contrast.
StaticgetReturns the minimum font size for a specific font weight.
The calculated APCA score.
The font weight (200, 300, 400, 500, 600, 700, 900).
The minimum size in pixels, or 999 if prohibited.
StaticisStaticisStaticisCheck if the text is light.
The color.
True if the color is light.
StaticisChecks compliance with WCAG 2.1 (AA or AAA).
The first color.
The second color.
Optionalopts: Partial<ReadableOptions>The options.
Staticrelative
Utilities for Web Content Accessibility Guidelines (WCAG) and APCA. Provides methods to check contrast ratios and readability.