NoColor bug on unfilled objects

AiScripts
2 min readJan 29, 2022

--

The NoColor class shows no color, which is similar to the false values of the filled and stroked properties. If the object is selected without stroked, the following ways of checking are the same:

if (selection[0].strokeColor == '[NoColor]'); // true
if (selection[0].stroked == false); // true

On Mac OS in Illustrator CC 2019 (23.1.1), 2018 (22.1), and possibly earlier versions, there is a bug in the fillColor property of PathItem and CompoundPathItem. If there is no fill, it returns not NoColor, but GrayColor with a gray channel value of 0, as if the object were filled with white. In this case, the filled property contains the correct status of false.

var msg = 'Adobe Illustrator: ' + app.version;
msg += '\nPath filled: ' + selection[0].filled;
msg += '\nPath fill: ' + selection[0].fillColor;
msg += '\nPath gray color: ' + selection[0].fillColor.gray;
alert(msg);

If you assign the NoColor class to an object, it will return the same GrayColor

var msg = 'Adobe Illustrator: ' + app.version;
var noColor = new NoColor();
selection[0].fillColor = noColor;
msg += '\nPath fill: ' + selection[0].fillColor;
alert(msg);

Adobe developers have fixed a bug starting with CC 2020 (Mac OS). An empty fill returns a NoColor class.

--

--

AiScripts

Sergey Osokin. I’m a illustrator & Script Developer (Ai, Ps). Writing about bugs and tricks.