function createContrastReport(context, artboard, {mode = Mode.IMAGE} = {}) {
  let artboardCopy = artboard.copy();
  context.document.currentPage().addLayer(artboardCopy);

  let visibleTextLayerInfos = findVisibleTextLayerInfos(artboardCopy);
  visibleTextLayerInfos.forEach(({layer}) => layer.setIsVisible(false));
  let metaGroup = MSLayerGroup.new();
  metaGroup.setName(META_GROUP_NAME);
  if (mode == Mode.IMAGE) {
    artboardCopy.addLayer(metaGroup);
  } else {
    artboard.addLayer(metaGroup);
  }
  let {image} = util.getArtboardImage(context.document, artboardCopy);
  let bitmapImageRep = NSBitmapImageRep.imageRepWithData(image.TIFFRepresentation());
  for (let {layer, opacity, rectangle} of visibleTextLayerInfos) {
    let rating = getTypeContrastRating(
        layer, opacity, rectangle, bitmapImageRep);
        renderContrastReportOverlay(metaGroup, rectangle, rating);
  }
  visibleTextLayerInfos.forEach(({layer}) => layer.setIsVisible(true));
  let returnValue = {};
  if (mode == Mode.IMAGE) {
    returnValue = util.getArtboardImage(context.document, artboardCopy);
  }

  artboardCopy.removeFromParent();
  return returnValue;
}
/**
 * Creates a contrast report for the given artboard. Mode options are IMAGE,
 * which produces a PNG file report, or INLINE which draws the report in the artboard.
 */
Creates a contrast report for the given artboard. Mode options are IMAGE,
which produces a PNG file report, or INLINE which draws the report in the artboard.
Creates a contrast report for the given artboard . Mode options are IMAGE which produces a PNG file report or INLINE which draws the report in the artboard .
function createContrastReport(context, artboard, {mode = Mode.IMAGE} = {}) {
  let artboardCopy = artboard.copy();
  context.document.currentPage().addLayer(artboardCopy);
  let visibleTextLayerInfos = findVisibleTextLayerInfos(artboardCopy);
  visibleTextLayerInfos.forEach(({layer}) => layer.setIsVisible(false));
  let metaGroup = MSLayerGroup.new();
  metaGroup.setName(META_GROUP_NAME);
  if (mode == Mode.IMAGE) {
    artboardCopy.addLayer(metaGroup);
  } else {
    artboard.addLayer(metaGroup);
  }
  let {image} = util.getArtboardImage(context.document, artboardCopy);
  let bitmapImageRep = NSBitmapImageRep.imageRepWithData(image.TIFFRepresentation());
  for (let {layer, opacity, rectangle} of visibleTextLayerInfos) {
    let rating = getTypeContrastRating(
        layer, opacity, rectangle, bitmapImageRep);
        renderContrastReportOverlay(metaGroup, rectangle, rating);
  }
  visibleTextLayerInfos.forEach(({layer}) => layer.setIsVisible(true));
  let returnValue = {};
  if (mode == Mode.IMAGE) {
    returnValue = util.getArtboardImage(context.document, artboardCopy);
  }
  artboardCopy.removeFromParent();
  return returnValue;
}
function createContrastReport ( context , artboard , { mode = Mode . IMAGE } = { } ) { let artboardCopy = artboard . copy ( ) ; context . document . currentPage ( ) . addLayer ( artboardCopy ) ; let visibleTextLayerInfos = findVisibleTextLayerInfos ( artboardCopy ) ; visibleTextLayerInfos . forEach ( ( { layer } ) => layer . setIsVisible ( false ) ) ; let metaGroup = MSLayerGroup . new ( ) ; metaGroup . setName ( META_GROUP_NAME ) ; if ( mode == Mode . IMAGE ) { artboardCopy . addLayer ( metaGroup ) ; } else { artboard . addLayer ( metaGroup ) ; } let { image } = util . getArtboardImage ( context . document , artboardCopy ) ; let bitmapImageRep = NSBitmapImageRep . imageRepWithData ( image . TIFFRepresentation ( ) ) ; for ( let { layer , opacity , rectangle } of visibleTextLayerInfos ) { let rating = getTypeContrastRating ( layer , opacity , rectangle , bitmapImageRep ) ; renderContrastReportOverlay ( metaGroup , rectangle , rating ) ; } visibleTextLayerInfos . forEach ( ( { layer } ) => layer . setIsVisible ( true ) ) ; let returnValue = { } ; if ( mode == Mode . IMAGE ) { returnValue = util . getArtboardImage ( context . document , artboardCopy ) ; } artboardCopy . removeFromParent ( ) ; return returnValue ; }
Creates a contrast report for the given artboard.
Creates a contrast report for the given artboard .