Tint.Distance behaviour (Tint v1.1.0) View Source
A module providing functions for color distance calculations and a behavior to implement custom distance algorithms.
Link to this section Summary
Types
A distance calculation module that implements this very behavior or a function that allows calculating the distance between two colors.
A function that allows calculating the distance between two colors.
Functions
Calculate the distance of two colors using the given distance algorithm.
Gets the nearest color from the specified palette using the given distance algorithm.
Gets the nearest n colors from the specified palette using the given distance algorithm.
Callbacks
Calculate the distance of two colors using the given options.
Link to this section Types
Specs
distance_algorithm() :: module() | {module(), Keyword.t()} | distance_fun()
A distance calculation module that implements this very behavior or a function that allows calculating the distance between two colors.
Specs
distance_fun() :: (Tint.color(), Tint.color() -> number())
A function that allows calculating the distance between two colors.
Link to this section Functions
Specs
distance(Tint.color(), Tint.color(), distance_algorithm()) :: float()
Calculate the distance of two colors using the given distance algorithm.
Specs
nearest_color(Tint.color(), [Tint.color()], distance_algorithm()) :: nil | Tint.color()
Gets the nearest color from the specified palette using the given distance algorithm.
Specs
nearest_colors( Tint.color(), [Tint.color()], non_neg_integer(), distance_algorithm() ) :: [Tint.color()]
Gets the nearest n colors from the specified palette using the given distance algorithm.
Link to this section Callbacks
Specs
distance( color :: Tint.color(), other_color :: Tint.color(), opts :: Keyword.t() ) :: number()
Calculate the distance of two colors using the given options.