ICustomColorFormatter.cs 1.3 KB

123456789101112131415161718192021222324252627
  1. #nullable enable
  2. namespace Terminal.Gui;
  3. /// <summary>An interface to support custom formatting and parsing of <see cref="Color"/> values.</summary>
  4. public interface ICustomColorFormatter : IFormatProvider, ICustomFormatter
  5. {
  6. /// <summary>
  7. /// A method that returns a <see langword="string"/> based on the <paramref name="formatString"/> specified and
  8. /// the byte parameters <paramref name="r"/>, <paramref name="g"/>, <paramref name="b"/>, and <paramref name="a"/>,
  9. /// which are provided by <see cref="Color"/>
  10. /// </summary>
  11. /// <param name="formatString"></param>
  12. /// <param name="r"></param>
  13. /// <param name="g"></param>
  14. /// <param name="b"></param>
  15. /// <param name="a"></param>
  16. /// <returns></returns>
  17. string Format (string? formatString, byte r, byte g, byte b, byte a);
  18. /// <summary>A method that returns a <see cref="Color"/> value based on the <paramref name="text"/> specified.</summary>
  19. /// <param name="text">
  20. /// A string or other <see cref="ReadOnlySpan{T}"/> of <see langword="char"/> to parse as a
  21. /// <see cref="Color"/>.
  22. /// </param>
  23. /// <returns>A <see cref="Color"/> value equivalent to <paramref name="text"/>.</returns>
  24. Color Parse (ReadOnlySpan<char> text);
  25. }