@batpb/genart - v2.0.0-rc.3-alpha.1
    Preparing search index...

    Class ColorNames

    Manager to store and retrieve the names of colors based on their hex string value. When a name has not yet been stored or found, the nearest color algorithm will be applied to find the name of the next closest color.

    2.0.0

    Index

    Constructors

    • Returns ColorNames

      • ColorNames is a static class and cannot be instantiated.

      2.0.0

    Methods

    • Map the given hex to the given name.

      Parameters

      • hex: string

        The hex string to map.

      • name: string

        The name to map the hex string to.

      Returns void

      2.0.0

    • Map the given PaletteColor.HEX to the given PaletteColor.NAME.

      Parameters

      Returns void

      2.0.0

    • Retrieves the name of the color represented by the given colorHex. If the colorHex string is not well formatted or the nearest color function encounters an error, the method will return undefined.

      Parameters

      • colorHex: string

        The hex string representation of the color (format: #RRGGBB).

      Returns undefined | string

      2.0.0

    • Does the given hex string already have a color name match?

      Parameters

      • hex: string

        the hex string to check.

      Returns boolean

      true if the hex has a direct color name match in the manager, false if it does not.

      2.0.0

    • Set the color names that could possibly be selected when searching for the nearest color match in getColorName.

      Parameters

      • colorNames: { hex: string; name: string }[]

        An array of color objects with the properties name and hex.

      Returns void

      2.0.0