@skchr/color
    Preparing search index...

    Function nearest

    • Returns the nearest color(s) in a collection as compared against the passed in color using the differenceHyab metric function.

      • To get the nearest color from the Tailwind CSS default palette pass in the string tailwind as the collection parameter.
      • If the num parameter is more than 1, the returned collection of colors has the colors sorted starting with the nearest color first

      Parameters

      • collection: Collection | "tailwind" = []

        The collection of colors to search for nearest colors.

      • Optionaloptions: { against: "cyan"; num: 1 }

        Optional overrides with num and against properties.

      Returns any

      • The nearest color(s) from the collection.
      let cols = colors('all', '500')

      console.log(nearest(cols, 'blue', 3));
      // [ '#a855f7', '#8b5cf6', '#d946ef' ]