src/illustrator/swatches.js
function addSwatch(name, color) {
  var swatch = doc.swatches.add();
  swatch.color = color;
  swatch.name = name;

  return swatch;
}
function addSwatch(name, color) {
  var swatch = doc.swatches.add();
  swatch.color = color;
  swatch.name = name;

  return swatch;
}
function addSwatch ( name , color ) { var swatch = doc . swatches . add ( ) ; swatch . color = color ; swatch . name = name ; return swatch ; }
Adds swatch.

@param   {String} name
@param   {Color} color
@returns {Swatch}
Adds swatch .