IColorNameResolver.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. namespace Terminal.Gui;
  2. /// <summary>
  3. /// When implemented by a class, allows mapping <see cref="Color"/> to
  4. /// human understandable name (e.g. w3c color names) and vice versa.
  5. /// </summary>
  6. public interface IColorNameResolver
  7. {
  8. /// <summary>
  9. /// Returns the names of all known colors.
  10. /// </summary>
  11. /// <returns></returns>
  12. IEnumerable<string> GetColorNames ();
  13. /// <summary>
  14. /// Returns <see langword="true"/> if <paramref name="color"/> is a recognized
  15. /// color. In which case <paramref name="name"/> will be the name of the color and
  16. /// return value will be true otherwise false.
  17. /// </summary>
  18. /// <param name="color"></param>
  19. /// <param name="name"></param>
  20. /// <returns></returns>
  21. bool TryNameColor (Color color, out string name);
  22. /// <summary>
  23. /// Returns <see langword="true"/> if <paramref name="name"/> is a recognized
  24. /// color. In which case <paramref name="color"/> will be the color the name corresponds
  25. /// to otherwise returns false.
  26. /// </summary>
  27. /// <param name="name"></param>
  28. /// <param name="color"></param>
  29. /// <returns></returns>
  30. bool TryParseColor (string name, out Color color);
  31. }