function renderContrastReportOverlay(metaGroup, {x, y, w, h}, {contrastRatio, note, status}) {
  let overlayText = note;
  let fillLayer = MSShapeGroup.shapeWithRect(NSMakeRect(x, y, w, h));
  let fill = fillLayer.style().addStylePartOfType(util.StylePartType.FILL);
  switch (status) {
    case 'pass':
      fill.color = Colors.PASS;
      break;
    case 'fail':
      fill.color = Colors.FAIL;
      overlayText = formatContrastRatio(contrastRatio);
      break;
    case 'unknown':
    case 'mixed':
      fill.color = Colors.UNKNOWN;
      break;
  }
  metaGroup.addLayer(fillLayer);
  if (overlayText) {
    let overlayTextLayer = MSTextLayer.new();
    overlayTextLayer.setStringValue(overlayText);
    if (w < 100) {
      let delta = (100 - w);
      x -= delta / 2;
      w = 100;
    }
    overlayTextLayer.frame = MSRect.rectWithRect(NSMakeRect(x, y, w, h));
    overlayTextLayer.setTextBehaviour(2); // fixed
    overlayTextLayer.setTextAlignment(2); // center
    overlayTextLayer.setVerticalAlignment(1); // center
    overlayTextLayer.setFont(NSFont.boldSystemFontOfSize(10));
    overlayTextLayer.setTextColor(util.svgColorToMSColor('#fff'));
    let shadow = overlayTextLayer.style().addStylePartOfType(util.StylePartType.SHADOW);
    shadow.offsetX = 0;
    shadow.offsetY = 1;
    shadow.blurRadius = 1;
    shadow.color = util.svgColorToMSColor('rgba(0,0,0,0.5)');
    metaGroup.addLayer(overlayTextLayer);
  }
}
/**
 * Renders a contrast report overlay at the given coordinates (pass/fail, etc)
 */
Renders a contrast report overlay at the given coordinates (pass/fail, etc)
Renders a contrast report overlay at the given coordinates ( pass / fail etc )
function renderContrastReportOverlay(metaGroup, {x, y, w, h}, {contrastRatio, note, status}) {
  let overlayText = note;
  let fillLayer = MSShapeGroup.shapeWithRect(NSMakeRect(x, y, w, h));
  let fill = fillLayer.style().addStylePartOfType(util.StylePartType.FILL);
  switch (status) {
    case 'pass':
      fill.color = Colors.PASS;
      break;
    case 'fail':
      fill.color = Colors.FAIL;
      overlayText = formatContrastRatio(contrastRatio);
      break;
    case 'unknown':
    case 'mixed':
      fill.color = Colors.UNKNOWN;
      break;
  }
  metaGroup.addLayer(fillLayer);
  if (overlayText) {
    let overlayTextLayer = MSTextLayer.new();
    overlayTextLayer.setStringValue(overlayText);
    if (w < 100) {
      let delta = (100 - w);
      x -= delta / 2;
      w = 100;
    }
    overlayTextLayer.frame = MSRect.rectWithRect(NSMakeRect(x, y, w, h));
    overlayTextLayer.setTextBehaviour(2); 
    overlayTextLayer.setTextAlignment(2); 
    overlayTextLayer.setVerticalAlignment(1); 
    overlayTextLayer.setFont(NSFont.boldSystemFontOfSize(10));
    overlayTextLayer.setTextColor(util.svgColorToMSColor('#fff'));
    let shadow = overlayTextLayer.style().addStylePartOfType(util.StylePartType.SHADOW);
    shadow.offsetX = 0;
    shadow.offsetY = 1;
    shadow.blurRadius = 1;
    shadow.color = util.svgColorToMSColor('rgba(0,0,0,0.5)');
    metaGroup.addLayer(overlayTextLayer);
  }
}
function renderContrastReportOverlay ( metaGroup , { x , y , w , h } , { contrastRatio , note , status } ) { let overlayText = note ; let fillLayer = MSShapeGroup . shapeWithRect ( NSMakeRect ( x , y , w , h ) ) ; let fill = fillLayer . style ( ) . addStylePartOfType ( util . StylePartType . FILL ) ; switch ( status ) { case 'pass' : fill . color = Colors . PASS ; break ; case 'fail' : fill . color = Colors . FAIL ; overlayText = formatContrastRatio ( contrastRatio ) ; break ; case 'unknown' : case 'mixed' : fill . color = Colors . UNKNOWN ; break ; } metaGroup . addLayer ( fillLayer ) ; if ( overlayText ) { let overlayTextLayer = MSTextLayer . new ( ) ; overlayTextLayer . setStringValue ( overlayText ) ; if ( w < 100 ) { let delta = ( 100 - w ) ; x -= delta / 2 ; w = 100 ; } overlayTextLayer . frame = MSRect . rectWithRect ( NSMakeRect ( x , y , w , h ) ) ; overlayTextLayer . setTextBehaviour ( 2 ) ; overlayTextLayer . setTextAlignment ( 2 ) ; overlayTextLayer . setVerticalAlignment ( 1 ) ; overlayTextLayer . setFont ( NSFont . boldSystemFontOfSize ( 10 ) ) ; overlayTextLayer . setTextColor ( util . svgColorToMSColor ( '#fff' ) ) ; let shadow = overlayTextLayer . style ( ) . addStylePartOfType ( util . StylePartType . SHADOW ) ; shadow . offsetX = 0 ; shadow . offsetY = 1 ; shadow . blurRadius = 1 ; shadow . color = util . svgColorToMSColor ( 'rgba(0,0,0,0.5)' ) ; metaGroup . addLayer ( overlayTextLayer ) ; } }
Renders a contrast report overlay at the given coordinates (pass/fail, etc)
Renders a contrast report overlay at the given coordinates ( pass / fail etc )
// fixed // center // center