Selection to Swatches
Script for Adobe Illustrator
✦ Available exclusively on Patreon for Pro supporters.
ㅤ
Description
Selection to Swatches is an Adobe Illustrator script that automatically extracts colors and patterns from your selected objects and adds them to the Swatches panel. This powerful tool streamlines your workflow by eliminating the tedious manual process of creating swatches from your artwork.
The script intelligently detects and processes:
- Gradient colors (linear and radial)
- Solid colors (RGB, CMYK, Grayscale, and Lab)
- Patterns (fill and stroke patterns)
It automatically removes duplicates, provides customizable naming options, and can organize extracted swatches into color groups for better organization.
ㅤ
Features
- Extract gradients, solid colors, and patterns from selected objects
- Automatic duplicate detection - won't create swatches that already exist
- Customizable swatch naming with auto-numbering
- Choose between Process, Global, or Spot color types for solid colors
- Optional color group creation for easy organization
- Works with paths, compound paths, groups, and text frames
- Processes both fill and stroke colors
- User-friendly dialog interface with tooltips
ㅤ
Installation
1. Download the Selection to Swatches.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. The script will appear in Selection to Swatches.
5. Alternatively, you can run the script directly by going to File > Scripts > Other Script... and selecting the file from any location.
ㅤ
User Guide
ㅤ
Prepare Your Document
- Open an Adobe Illustrator document
- Select one or more objects that contain the colors or patterns you want to extract
ㅤ

ㅤ
- You can select paths, compound paths, groups, or text frames
- The script will analyze both fill and stroke colors
ㅤ
Run the Script
- Go to File > Scripts > Selection to Swatches
- The script will analyze your selection and open a dialog window
ㅤ

ㅤ
ㅤ
Configure Swatch Options
The dialog window is divided into four sections:
ㅤ
➊ Solid Color Swatches
- Checkbox: Enable/disable solid color extraction
- Swatch name: Enter a base name for color swatches (default: "Color")
- Swatches will be auto-numbered (e.g., "Color 1", "Color 2")
ㅤ
- Color Type: Choose how solid colors should be created:
- Process: Regular process colors (default)
- Global: Global process colors that update throughout the document when modified
- Spot: Spot colors for special printing processes
ㅤ
➋ Gradient Swatches
- Checkbox: Enable/disable gradient extraction
- Swatch name: Enter a base name for gradient swatches (default: "Gradient")
- Swatches will be auto-numbered (e.g., "Gradient 1", "Gradient 2")
ㅤ
➌ Pattern Swatches
- Checkbox: Enable/disable pattern extraction
- Swatch name: Enter a base name for pattern swatches (default: "Pattern")
- Swatches will be auto-numbered (e.g., "Pattern 1", "Pattern 2")
ㅤ
➍ Color Group Options
- Checkbox: Enable to create a color group containing all extracted swatches
- Group name: Enter a name for the color group (default: "Selection Colors")
ㅤ
➎ Extract Swatches
- Click OK to extract swatches based on your settings
- The script will process your selection and display a summary of results
- Open the Swatches panel (Window > Swatches) to see your new swatches
ㅤ

ㅤ
Review Results
After processing, you'll see a confirmation message showing:
- Total number of swatches added
- Breakdown by type (gradients, solid colors, patterns)
- Color group creation status (if enabled)
If no new swatches were added, the script will explain why (e.g., no colors found or all colors already exist).
ㅤ
ㅤ
Tips & Best Practices
- Selective Extraction: Uncheck swatch types you don't need to keep your Swatches panel organized
- Custom Naming: Use descriptive base names like "Logo Colors" or "Brand Gradients" for better organization
- Global Colors: Use Global color type when you want to update colors across multiple objects simultaneously
- Color Groups: Enable color group creation to keep related swatches organized and easy to find
- Duplicate Prevention: The script automatically skips colors that already exist in your Swatches panel
ㅤ
ㅤ
Conclusion
The Selection to Swatches script streamlines your Adobe Illustrator workflow by instantly converting colors, gradients, and patterns from selected artwork into organized swatches. With features like automatic duplicate detection and custom naming, it ensures your Swatches panel remains clean and project-ready.
Start using this script today to save time and maintain consistent color management across your designs.
ㅤ
ㅤ