code: function getContrastColor(bgColor, colors) {
    // We set a rather high cutoff to prefer light text if possible.
    const cutoff = 0.74;
  
    // Calculate the perceived luminosity (relative brightness) of the color.
    const perceivedLuminosity = Color(bgColor).luminosity();
  
    return perceivedLuminosity >= cutoff ? colors.dark : colors.light;
  }
docs: Calculates a contrast color for a given background color.
  The color will either be black or white depending on the perceived
  luminosity of the background color.
  @param {string} bgColor The background color.
  @param {Object} colors The full color variables.
  @returns {string} The contrast color.