IColorDistance.cs 829 B

123456789101112131415161718
  1. namespace Terminal.Gui;
  2. /// <summary>
  3. /// Interface for algorithms that compute the relative distance between pairs of colors.
  4. /// This is used for color matching to a limited palette, such as in Sixel rendering.
  5. /// </summary>
  6. public interface IColorDistance
  7. {
  8. /// <summary>
  9. /// Computes a similarity metric between two <see cref="Color"/> instances.
  10. /// A larger value indicates more dissimilar colors, while a smaller value indicates more similar colors.
  11. /// The metric is internally consistent for the given algorithm.
  12. /// </summary>
  13. /// <param name="c1">The first color.</param>
  14. /// <param name="c2">The second color.</param>
  15. /// <returns>A numeric value representing the distance between the two colors.</returns>
  16. double CalculateDistance (Color c1, Color c2);
  17. }