Wolfram Language Paclet Repository
Community-contributed installable additions to the Wolfram Language
WCAG color-contrast and accessibility utilities for the Wolfram Language
Contributed by: Nikolay Murzin
The package provides WCAGContrastRatio, WCAGLevel, AccessibleTextColor, and AdjustForContrast.
To install this paclet in your Wolfram Language environment,
evaluate this code:
PacletInstall["Wolfram/AccessibleColors"]
To load the code after installation, evaluate this code:
Needs["Wolfram`AccessibleColors`"]
Measure the contrast between two colors:
| In[1]:= |
| Out[1]= |
Grade a pair against the WCAG thresholds:
| In[2]:= |
| Out[2]= |
Repair a color so it clears AA:
| In[3]:= |
| Out[3]= |
Pick legible text for a background:
| In[4]:= |
| Out[4]= |
Choose a legible label color across a whole palette at once:
| In[5]:= |
| Out[5]= |
Build a light/dark adaptive text color for a white-then-black background:
| In[6]:= |
| Out[6]= |
Track the accessible text color live as a background is dragged:
| In[7]:= | ![]() |
| Out[7]= | ![]() |
Show each swatch in a palette labeled with the text color and ratio the package picks:
| In[8]:= | ![]() |
| Out[8]= |
Wolfram Language Version 14.0