@tremendous/help
    Preparing search index...

    Function adjustForLuminosity

    • Returns a contrasting color from the provided options based on the luminosity of the input color.

      Parameters

      • color: string

        The color to be evaluated.

      • lightColor: string

        The color to return if the original color is dark.

      • darkColor: string

        The color to return if the original color is light.

      Returns null | string

      • The appropriate color based on the luminosity, or null if the color is not a valid hex color.
      const contrastColor = adjustForLuminosity("#000000", "#ffffff", "#000000");
      console.log(contrastColor); // "#ffffff"