Contrast Checker
Script for Adobe Illustrator
✦ Available exclusively on Patreon for Pro supporters.
ㅤ
Description
Contrast Checker is a powerful Adobe Illustrator script that helps designers ensure their color combinations meet WCAG (Web Content Accessibility Guidelines) accessibility standards. The tool provides real-time contrast ratio calculations and allows you to adjust colors interactively to achieve the desired accessibility compliance.
ㅤ
Key Features
- WCAG Compliance Testing: Instantly check if your color combinations meet AA and AAA standards for normal text, large text, and graphics
- Real-time Contrast Calculation: See contrast ratios update live as you adjust colors
- Dual Color Space Support: Work with both HSB and RGB color models via tabbed interface
- Interactive Color Adjustment: Use sliders, numeric inputs, hex codes, or the native color picker
- Automatic Color Correction: Set a target contrast ratio and let the script adjust colors automatically
- Live Preview: See changes applied to your selected objects in real-time
- Swatch Integration: Optionally add your final colors to the document swatches panel
- Reset Functionality: Quickly revert to original colors
ㅤ
Installation
1. Download the Contrast Checker.jsx script file.
2. Place the script in your Adobe Illustrator Scripts folder:
⮑ Mac: /Applications/Adobe Illustrator <Version>/Presets/<Language>/Scripts
⮑ Windows: C:\Program Files\Adobe\Adobe Illustrator <Version>\Presets\<Language>\Scripts
3. Restart Adobe Illustrator if it's already running.
4. Alternatively, run it directly via File > Scripts > Other Script... and browse to the file location; or just drag and drop the .jsx file onto your Illustrator document window.
ㅤ
Running the Script
Option 1: With Selected Objects (Recommended)
- Select two objects in your Illustrator document
- First selection: Foreground color (e.g., text color)
- Second selection: Background color
- Both objects must have solid fill colors
- Run the script via File > Scripts > Contrast Checker
- The dialog will open with your selected colors loaded
ㅤ
Option 2: Without Selection
- Run the script without any selection
- The dialog opens with default colors (white background, black foreground)
- Adjust colors as needed using the controls
ㅤ
Using the Script
The Contrast Checker dialog is organized into several sections:
ㅤ
ㅤ

ㅤ
➊ Color Preview Panel
- Left half: Background color preview (click to open color picker)
- Right half: Foreground color preview (click to open color picker)
➋ Background Panel
- Hex Input: Enter or view hex color codes (e.g., FFFFFF)
- Reset Button: Revert to the original background color
- HSB Tab: Adjust Hue (0-360°), Saturation (0-100%), Brightness (0-100%)
- RGB Tab: Adjust Red, Green, Blue values (0-255)
➌ Foreground Panel
- Hex Input: Enter or view hex color codes
- Reset Button: Revert to the original foreground color
- HSB Tab: Adjust Hue, Saturation, Brightness
- RGB Tab: Adjust Red, Green, Blue values
➍ WCAG Results Panel
The script evaluates your color combinations against these accessibility criteria:
- Normal Text AA: 4.5:1 minimum contrast ratio
- Normal Text AAA: 7:1 minimum contrast ratio
- Large Text AA: 3:1 minimum contrast ratio
- Large Text AAA: 4.5:1 minimum contrast ratio
- Graphics AA: 3:1 minimum contrast ratio
ㅤ
The results panel displays pass/fail status for five accessibility standards:
- ✅ = Passed (green)
- ❌ = Failed (red)
➎ Contrast Controls Panel
- Contrast Slider & Input: Set target contrast ratio (1.0-21.0)
- Add to Swatches: Check to add both colors to document swatches
- Hide Edges: Toggle visibility of object edges in the document
- Preview: Enable to see changes applied to selected objects in real-time
➏ Step-by-Step Workflow
Basic Color Testing
- Select your background and foreground objects
- Run the script
- Review the WCAG results panel to see which standards are met
- If needed, adjust colors using the controls
- Click OK to apply changes or Cancel to discard
ㅤ
Adjusting Colors Manually
Using Sliders:
- Switch between HSB and RGB tabs as preferred
- Drag sliders to adjust color values
- Watch the contrast ratio and WCAG results update in real-time
ㅤ
Using Numeric Inputs:
- Click in any numeric field
- Type a new value
- Press Enter or Tab to apply
- Use Up/Down arrow keys for fine adjustments (hold Shift for larger steps)
ㅤ
Using Hex Codes:
- Click in the hex input field
- Type or paste a hex color code (with or without #)
- The color updates automatically as you type
ㅤ
Using Color Picker:
- Click on the background or foreground color preview at the top
- Choose a color from Illustrator's native color picker
- Click OK to apply the selected color
ㅤ
Achieving Target Contrast Ratio
- In the Contrast Controls panel, enter your desired ratio (e.g., 4.5 for AA normal text)
- Or use the contrast slider to select a ratio
- The script automatically adjusts both colors to meet the target
- Fine-tune manually if needed
ㅤ
Keyboard Shortcuts for Contrast Field:
- Up/Down arrows: Adjust by 0.1
- Shift + Up/Down arrows: Adjust by 1
ㅤ
Using Live Preview
- Check the Preview checkbox (enabled by default when objects are selected)
- All color adjustments are immediately applied to your selected objects
- Uncheck to disable live updates
- Click Cancel to revert all preview changes
ㅤ
Saving Colors to Swatches
- Check Add to Swatches before clicking OK
- Both background and foreground colors will be added to your document's swatches panel
- Swatches are named with their hex values (e.g., "BG #FFFFFF", "FG #000000")
☻ Wrap Up
Whether you're designing for web, print, or digital media, this script makes it easy to create accessible color palettes that work for everyone, including users with visual impairments.