ICustomColorFormatter.cs 1.2 KB

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