function mask2DataURL(singleChannelData, w, h, color) {
  const canvas = document.createElement("canvas");
  const ctx = canvas.getContext("2d");

  canvas.width = w;
  canvas.height = h;

  const numChannels = 1;

  setMaskPixelColors(ctx, singleChannelData, w, h, color, numChannels);

  const url = canvas.toDataURL();

  return url;
}
Given a single channel UInt8 image data mask with non-zero values indicating the
mask, turn it into a 4 channgel RGBA image data URL filled in with the given
color for pixels turned on in the mask.
@param {ImageData} Single channel image mask data.
@param {number} w Width of the resulting image data URL.
@param {number} h Height of the resulting image data URL.
@param {string} color Hex color of the resulting mask image.
@returns {string} Data URL containing the mask as an image.