Adobe Illustrator
js
scripts that could help to improve productivity and avoid possible human errors when working with SVG Icons.
Name Basic Layers
Sets a progressive Layer name (default layerX where x
is a progressive number) depending on the fillColor
or strokeColor
(if it is a stroked or filled path
). In case an element in the same Artboard has the same color, the same Layer name will be stored in memory.
important note: this script
is intended to be used only when there is an unified style in the Artboard, that is: all paths are stroke or all paths are filled, not mixed. Use is-unified script to check if all Artboards respect this rule.
Name Mixed Layers
Loop into each Artboard and set a name on each path
that has stroke
, transparency
and color
.
Works similarly as name-basic-layers.js
but with more features for situations where there are combined styles in each Artboard.
Sets a name for each layer that is stroked
(default name: stroke
), another name for each layer or group with transparency
less than 100%
, and the progressive names for each filled
layer.
Note that the result in each Artboard will respect this rules:
- each
stroked path
will be named as stroke (default) - each
filled path
orgroup
withtransparency
will be named as opacity (default) * - each
filled path
withouttransparency
will be named progressively like layer1 and so on (default) and assign the same name for the same color layer *
* filled paths
inside a group
with transparency
won't receive any name
important note: this script
may not work in some situations and is only intended to solve specific needs as described above.
Ungroup
Due to an Illustrator bug when exporting named layers in nested groups
, which in some cases do not receive its related property, this script
ungroups everything but the transparency
group (which are normally named before).
Unify Color
Once all desired layers are named, it is sometimes useful to set all paths
in one given color. As in the other scripts
, this will set the strokeColor
or fillColor
depending on the path
.
Is Unified Style
Checks if each Artboard has paths
with strictly the same style (filled
or stroked
). The script
breaks as soon as it finds a mixed Artboard and tell which one it is (it also remains selected, making it easy to fix).
Rename Artboards
Loop into each Artboard and rename it with a String
provided plus the Artboard number as a suffix.
Center in Artboard
Loop into each Artboard and center its content. To guarantee the relative positions of its paths
, the script
group the content before centering it.
Export PNG
Loop into each Artboard and exports as a .png
file in 1x, 2x and 3x resolution, organized in different folders. Filename will be the String
provided followed by the Artboard name.
Once open the file with at least one Artboard
File > Scripts > Other Script…
Then select the script
you want to use.
These scripts
helps authoring Icons and apply rules needed to work in the Orion Icon Library App