Tint v1.0.2 Tint.Distance behaviour 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
distance_algorithm()
View Source
distance_algorithm() :: module() | {module(), Keyword.t()} | distance_fun()
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.
distance_fun()
View Source
distance_fun() :: (Tint.color(), Tint.color() -> number())
distance_fun() :: (Tint.color(), Tint.color() -> number())
A function that allows calculating the distance between two colors.
Link to this section Functions
distance(color, other_color, distance_algorithm)
View Source
distance(Tint.color(), Tint.color(), distance_algorithm()) :: float()
distance(Tint.color(), Tint.color(), distance_algorithm()) :: float()
Calculate the distance of two colors using the given distance algorithm.
nearest_color(color, palette, distance_algorithm)
View Source
nearest_color(Tint.color(), [Tint.color()], distance_algorithm()) ::
nil | Tint.color()
nearest_color(Tint.color(), [Tint.color()], distance_algorithm()) :: nil | Tint.color()
Gets the nearest color from the specified palette using the given distance algorithm.
nearest_colors(color, palette, n, distance_algorithm)
View Source
nearest_colors(
Tint.color(),
[Tint.color()],
non_neg_integer(),
distance_algorithm()
) :: [Tint.color()]
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
distance(color, other_color, opts)
View Source
distance(
color :: Tint.color(),
other_color :: Tint.color(),
opts :: Keyword.t()
) :: number()
distance( color :: Tint.color(), other_color :: Tint.color(), opts :: Keyword.t() ) :: number()
Calculate the distance of two colors using the given options.