Creating professional color swatch legends in Adobe Illustrator is a tedious task that every designer dreads. Whether you are working on brand style guides, print production documents, or client presentations, you need clear, accurate color references that display PMS (Pantone Matching System) names and CMYK values properly.
Manually creating these legends means drawing boxes, typing text, aligning elements, and double-checking every color value. This process can take hours, especially when you have dozens of swatches to document. Worse, manual errors can lead to incorrect color specifications in your final output.
That is exactly why Akib Mahmud, a skilled developer from Bangladesh, created these three powerful Adobe Illustrator scripts under the banner of AK Visual Studio. These JavaScript-based automation tools generate complete color swatch legends instantly, saving you hours of manual work while ensuring professional, accurate results every single time.
In this comprehensive guide, we will walk you through everything you need to know about these three essential scripts. You will learn how to install them, how each script works, what features they offer, and how to customize them for your specific workflow. By the end of this blog post, you will have a complete understanding of how to automate your color swatch documentation in Adobe Illustrator.
Why You Need Automated Swatch Legend Scripts
Before diving into the scripts themselves, let us understand why automation is crucial for color documentation in professional design workflows.
Save Hours of Manual Work
Creating a swatch legend manually requires drawing multiple rectangles, typing color names, adding percentage values, aligning everything properly, and then ensuring consistency across all swatches. With these scripts, the entire process happens in seconds. Select your swatches, run the script, and you get a perfectly formatted legend ready for use.
Eliminate Human Errors
When you type color values manually, mistakes happen. A misplaced decimal, a wrong percentage, or an incorrect color name can lead to production errors. These scripts pull data directly from Illustrator's swatch library, ensuring 100% accuracy in all displayed values.
Maintain Professional Consistency
Every legend generated by these scripts follows the same clean, organized format. This consistency is crucial for brand guidelines, style guides, and professional documentation. Your clients and team members will appreciate the polished, uniform appearance.
Support Multiple Color Models
Whether you are working with spot colors, process colors, RGB, or Lab colors, these scripts handle them all. The intelligent conversion system ensures that CMYK values are always displayed correctly, regardless of the original color model.
Installation Guide: Getting Started
Locate the Scripts Folder
Root Drive (C:\ or other installed drive):\Adobe\Adobe Illustrator 2025\Presets\en_US\Scripts\
For Mac Users:
/Applications/Adobe Illustrator 2025/Presets/en_US/Scripts/
Note: The version number (2025) may vary based on your Illustrator version. Look for your specific version folder.
Install the Script Files
Once you have located the scripts folder, follow these steps:
- Download the script files from the download links provided below
- Copy the .jsx or .jsxbin files to the Scripts folder
- Restart Adobe Illustrator completely
- Access the scripts from File → Scripts menu
Verify Installation
- To confirm the scripts are installed correctly:
- Open Adobe Illustrator
- Go to File in the top menu
- Hover over Scripts
- You should see the script names in the dropdown menu
Pro Installation Tip
If you frequently use these scripts, consider creating keyboard shortcuts:
- Go to Edit → Keyboard Shortcuts
- Select Scripts from the menu list
- Assign custom shortcuts to your most-used scripts
- Save your shortcut set
Script 1: PMS (Pantone Solid Coated) Color Value Script
What Makes This Script Unique
Key Features in Detail
Intelligent Color Sorting System
Advanced Text Formatting Options
Flexible Layout Configuration
Automatic PMS Name Conversion
White and Black Color Detection
How to Use the PMS Script
- Open your Adobe Illustrator document
- Navigate to the Swatches panel (Window → Swatches)
- Select all the PMS swatches you want to include in your legend
- Go to File → Scripts and choose "PMS Color Value"
- The script automatically generates your legend
Ideal Use Cases
Brand Style Guides
Print Production Documents
Client Presentations
Sample Output
Script 2: CMYK Color Value Script
The Importance of CMYK Documentation
Advanced Features Breakdown
Precise CMYK Value Display
Comprehensive Layer Management
Intelligent Color Detection
- White Detection: Identifies pure white colors and applies a thin black stroke to the color box, ensuring visibility
- Rich Black Detection: Recognizes rich black formulations and treats them appropriately
- Pure Black Detection: Identifies standard black colors for proper sorting and display
Smart Sorting with Visual Priority
Automatic Color Conversion
Step-by-Step Usage Guide
Where to Use This Script
Output Format
- A color-filled box (with stroke for white colors)
- The CMYK values formatted as percentages
- Clean alignment with consistent spacing
- Black text for maximum readability
- All elements organized in a named group
Script 3: PMS + CMYK Dual Line Script
Why Combine PMS and CMYK?
Comprehensive Feature Set
Dual Information Display
- Line 1: PMS name (or "Process Color" for non-spot colors)
- Line 2: Complete CMYK percentages
Automatic Color Type Recognition
- Spot Colors: Display their full PMS name
- Process Colors: Labeled as "Process Color"
- RGB/Lab Colors: Converted and displayed with CMYK values
Enhanced Vertical Spacing
Complete Color Conversion
- CMYK colors display their exact values
- RGB colors convert to CMYK accurately
- Lab colors convert through Illustrator's engine
- Gray colors display as K-only values
Usage Instructions
Select Your Swatches
Run the Script
Review the Legend
- Each swatch's color box
- PMS name on the top line
- CMYK values on the bottom line
- Properly aligned and spaced text
Best Applications
Comprehensive Brand Guidelines
Complete Print Specifications
Color Library Documentation
Client Color Presentations
Smart Sorting Technology Explained
All three scripts use the same advanced sorting algorithm developed by Akib Mahmud at AK Visual Studio. This algorithm ensures your swatches appear in the most logical, visually pleasing order possible.
The Sorting Process
Step 1: Color Analysis
The script analyzes each swatch to determine:
- Its CMYK and RGB values
- Perceived brightness using perceptual weighting
- Hue angle in the color wheel
- Whether it's white, black, or a rich black
Step 2: White and Black Positioning
White colors are placed at the very end of the list. This prevents them from disrupting the visual flow of the color spectrum. Black colors come just before white, creating a natural dark-to-light progression.
Step 3: Brightness-Based Ordering
Remaining colors are sorted by brightness, from brightest to darkest. This creates a smooth visual transition that makes the legend easier to scan and understand.
Step 4: Hue Grouping
When colors have similar brightness levels, they are grouped by hue. This ensures the legend shows natural color families, making it easier to find related colors.
Why This Sorting Matters
Improved Visual Appeal
Colors arranged in a logical order are simply more pleasant to look at. The sorting algorithm creates a beautiful rainbow-like progression that enhances the professional appearance of your legends.
Faster Color Finding
When colors are organized by brightness and hue, you can quickly scan the legend and find the color you need. This saves time during design work and color selection.
Better Communication
A well-organized legend communicates professionalism and attention to detail. Your clients and team members will appreciate the thoughtful arrangement.
Simplified Comparison
When similar colors are grouped together, you can easily compare them. This is especially useful when selecting between similar shades or checking color consistency.
Troubleshooting Common Issues
Installation Problems
Script Not Appearing in Menu
- Verify the folder location: Make sure you copied the script to the correct Scripts folder for your Illustrator version
- Check file extension: The file should have a .jsx or .jsxbin extension
- Restart Illustrator: Close and reopen Illustrator completely
- Check permissions: On Mac, ensure the file has read permissions
- Clear script cache: Sometimes Illustrator caches scripts; renaming the file slightly can help
Script Shows Errors
- Check Illustrator version: These scripts work best with CS6 and above
- Verify document mode: The scripts work in both RGB and CMYK documents
- Check selected swatches: Make sure at least one swatch is selected
- Ensure layers are unlocked: The script attempts to unlock layers, but locked sublayers can cause issues
Runtime Errors
"No swatches selected!" Error
- Open the Swatches panel (Window → Swatches)
- Click on the swatches you want to document
- Hold Ctrl (Windows) or Cmd (Mac) to select multiple swatches
- Run the script again
"PMS ERROR" Message
- Ensure you are using spot colors
- Check that the spot color has a proper Pantone name
- Consider using the CMYK or Dual script instead
Font-Related Issues
- Check your installed fonts list
- Change the fontName parameter in CONFIG
- Use a standard font like "ArialMT" or "Helvetica"
Output Problems
- Check the viewCenter calculation in the script
- Ensure useCenteredView is set to true
- Manually reposition the legend after generation
Text Overlapping
- Increase itemWidth for more horizontal space
- Increase rowHeight for more vertical space
- Reduce textSize for smaller text
- Adjust textVerticalNudge for better alignment
Color Boxes Too Small
- Increase boxSize in the CONFIG section
- Adjust itemWidth to accommodate larger boxes
- Consider scaling the entire legend after generation
Performance Issues
Script Runs Slowly
- Select fewer swatches at a time
- Close unused panels and documents
- Increase system resources for Illustrator
- Use the script during off-peak hours
Illustrator Becomes Unresponsive
- Wait a few moments - large documents take time
- Force quit if necessary (loss of unsaved work possible)
- Reduce the number of selected swatches
- Split swatches into multiple batches
Pro Tips for Maximum Efficiency
Organize Your Swatches First
- Name swatches clearly: Use consistent naming conventions
- Delete unused swatches: This reduces clutter and processing time
- Group related colors: Keep your swatches organized in the panel
- Create swatch libraries: Save organized swatch sets for reuse
Customize Configuration for Your Needs
- Adjust for document size: Larger documents need larger text
- Consider your audience: Clients need readability, production needs accuracy
- Match your brand: Use your brand fonts and colors
- Save custom versions: Create modified scripts for different use cases
Create Keyboard Shortcuts
- Go to Edit → Keyboard Shortcuts
- Select "Scripts" from the dropdown
- Assign shortcuts to your most-used scripts
- Save your shortcut set
Batch Process When Possible
- Process swatches in logical batches
- Combine multiple legends in one document
- Create master legend documents for reference
- Use scripts in templates for consistency
Document Your Settings
- Note which settings work best for different projects
- Create configuration templates
- Share settings with your design team
- Update scripts when workflow changes
Download Links
Frequently Asked Questions
About the Developer
Other Projects
- Document automation scripts
- Color management tools
- Layout optimization utilities
- Production workflow enhancers
Vision and Philosophy
Legal Notice and Disclaimer
Terms of Use
- Use at your own risk: The scripts are provided "as is" without warranty
- No liability: AK Visual Studio and Akib Mahmud are not liable for any damages or losses
- Intellectual property: The scripts and their code remain the property of AK Visual Studio
- Modification: You may modify the scripts for personal use, but modified versions are your responsibility
Important Disclaimer
Users are advised to:
- Test scripts in non-production environments first
- Keep backup copies of important documents
- Verify output before using in critical projects
- Review and understand configuration settings
- Maintain original script backups for reference
Connect with AK Visual Studio
- Website: www.akvisualstudio.com
- Developer: Akib Mahmud
- Country: Bangladesh
- Year: © 2026


