Smart Swatch Randomizer
Script for Adobe Illustrator
✦ Available exclusively on Patreon for Pro supporters.
ㅤ
Description
Smart Swatch Randomizer is an Adobe Illustrator script that intelligently applies random colors from your document's swatches to selected objects. This script offers advanced features like grouping objects by their original color, filtering swatches by name or group, and real-time preview with live randomization.
Whether you're working with complex illustrations or simple shapes, this tool streamlines the process of applying and experimenting with color variations.
ㅤ
Key Features
- Real-time Preview: See color changes instantly as you adjust settings
- Group by Color: Objects with the same original color receive the same new color, maintaining visual relationships
- Swatch Filtering: Search and filter swatches by name for quick selection
- Group Selection: Select all swatches from the same swatch group with one click
- Selective Application: Choose to apply colors to fills, strokes, or both
- Live Randomization: Shuffle colors with a single click while keeping your settings
- Smart Object Support: Works with paths, compound paths, groups, and text frames
- Hide Edges: Toggle selection edges for a cleaner preview
ㅤ


ㅤ
Installation
1. Download the Smart Swatch Randomizer.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 Smart Swatch Randomizer.jsx file onto your Illustrator document window.
ㅤ
Using the Script
ㅤ
Prepare Your Document
Before running the script, ensure you have:
- An open Illustrator document
- At least multiple swatches are saved in your Swatches panel
- One or more objects selected on your artboard
Launch the Script
Run the script via File > Scripts > Smart Swatch Randomizer
The dialog window will open, displaying all available options and swatches from your document:
ㅤ

ㅤ
➊ Configure Options
Apply to:
- Fills: Check to randomize fill colors
- Strokes: Check to randomize stroke colors
- Select at least one option (both can be enabled simultaneously)
ㅤ
Group by Color:
- When enabled: Objects with identical original colors will receive the same new color
- When disabled: Each object gets a completely random color
- Useful for maintaining color relationships in complex artwork
➋ Select Swatches
The Swatches panel displays all available swatches in a two-column list:
- Left column: Swatch group name (if applicable)
- Right column: Swatch name
ㅤ
Search Swatches:
- Type in the search bar to filter swatches by name
- Click the ✖ button to clear the search
ㅤ
Selection Tools:
- Select All: Select all visible swatches in the list
- Deselect All: Clear all selections
- Invert Selection: Flip the current selection state
- Select Group: Select all swatches from the same group as currently selected swatches
ㅤ
Tip: Use Ctrl/Cmd-click to select multiple individual swatches, or Shift-click to select a range.
➌ Preview and Randomize
ㅤ
Preview:
- Enabled by default to show real-time color changes
- Uncheck to disable live preview (colors will apply when you click OK)
- When enabled, colors update automatically as you change settings
ㅤ
Hide Edges:
- Check to hide selection edges for a cleaner preview
- Useful when evaluating color combinations without visual distractions
ㅤ
Randomize Button:
- Click to shuffle the random seed and generate a new color distribution
- Only available when Preview is enabled
- Keeps your current settings while changing which colors are assigned
➍ Apply or Cancel
ㅤ
OK Button:
- Applies the current color configuration and closes the dialog
- If Preview is disabled, colors are applied at this moment
- If Preview is enabled, the current preview becomes permanent
ㅤ
Cancel Button:
- Restores all objects to their original colors
- Closes the dialog without making changes
ㅤ
Zoom Button (✚):
- Fits the selected objects in the window for better viewing
- Helpful when working with large or small selections
➎ Tips and Tricks
- Pre-select swatches: Select swatches in your Swatches panel before running the script—they'll be pre-selected in the dialog
- Swatch groups: Organize swatches into groups for easier selection using the "Select Group" feature
- Naming conventions: Use consistent naming (e.g., "Brand/Primary", "Brand/Secondary") to leverage the group detection feature
- Quick iterations: Keep Preview enabled and use the Randomize button to quickly explore different color combinations
- Complex artwork: Enable "Group by Color" when working with illustrations that have intentional color relationships
- Performance: For very large selections, consider disabling Preview until you've finalized your swatch selection
☻ Wrap-up
Smart Swatch Randomizer is an Adobe Illustrator script that intelligently applies random colors from your document's swatches to selected objects with advanced control features.
It offers real-time preview, the ability to group objects by their original color to maintain visual relationships, swatch filtering by name or group, and live randomization – making it perfect for quickly exploring color variations and experimenting with different color schemes in your artwork.
ㅤ
ㅤ