The script renderSwatchLegend.jsx
is a script to create swatch legend on artboard.

It automatically generates a color swatch legend inside the Illustrator document based on the currently selected swatches.
Here’s what it does:
- Reads the selected swatches from the active Illustrator document.
- Creates a group of rectangles (legend blocks), each filled with a swatch color.
- Adds a text label next to each swatch that can include:
- The swatch name (optional).
- The color values in chosen color spaces: HEX, RGB, CMYK, LAB, or Grayscale.
- Formatting options like uppercase HEX, with/without
#
, joined or split components, separators, and adjustable text size.
In short:
👉 It builds a visual and textual swatch reference table directly in your Illustrator document, useful for client presentations, documentation, or style guides.