rebuildColorFile = (slugsAndIconPaths, colorsFile, root) => {
  let oldColors
  try {
    oldColors = require(colorsFile)
  } catch (e) {
    oldColors = {}
  }

  getColors(slugsAndIconPaths, oldColors, root).then((colors) => {
    try {
      fs.writeFileSync(colorsFile, stringify(colors, { space: 2 }))
    } catch (e) {
      console.error(`Error writing ${colorsFile}`, e)
    }
  })
}
Wrapper around getColors() that uses the same file for input & output,
refreshing the file when the data changes

@param slugsAndIconPaths [ { slug: foo, iconPath: bar } ... ]
@param colorsFile: the file that keeps the list of complimentary colors
@param root: repo toplevel directory so that saved iconPaths are relative to it