Application.Driver.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #nullable enable
  2. namespace Terminal.Gui.App;
  3. public static partial class Application // Driver abstractions
  4. {
  5. internal static bool _forceFakeConsole;
  6. // Internal helper method for ApplicationImpl.ResetState to clear this field
  7. internal static void ClearForceFakeConsole ()
  8. {
  9. _forceFakeConsole = false;
  10. }
  11. /// <summary>Gets the <see cref="IConsoleDriver"/> that has been selected. See also <see cref="ForceDriver"/>.</summary>
  12. public static IConsoleDriver? Driver
  13. {
  14. get => ApplicationImpl.Instance.Driver;
  15. internal set => ApplicationImpl.Instance.Driver = value;
  16. }
  17. /// <summary>
  18. /// Gets or sets whether <see cref="Application.Driver"/> will be forced to output only the 16 colors defined in
  19. /// <see cref="ColorName16"/>. The default is <see langword="false"/>, meaning 24-bit (TrueColor) colors will be output
  20. /// as long as the selected <see cref="IConsoleDriver"/> supports TrueColor.
  21. /// </summary>
  22. [ConfigurationProperty (Scope = typeof (SettingsScope))]
  23. public static bool Force16Colors
  24. {
  25. get => ApplicationImpl.Instance.Force16Colors;
  26. set => ApplicationImpl.Instance.Force16Colors = value;
  27. }
  28. /// <summary>
  29. /// Forces the use of the specified driver (one of "fake", "dotnet", "windows", or "unix"). If not
  30. /// specified, the driver is selected based on the platform.
  31. /// </summary>
  32. /// <remarks>
  33. /// Note, <see cref="Application.Init(IConsoleDriver, string)"/> will override this configuration setting if called
  34. /// with either `driver` or `driverName` specified.
  35. /// </remarks>
  36. [ConfigurationProperty (Scope = typeof (SettingsScope))]
  37. public static string ForceDriver
  38. {
  39. get => ApplicationImpl.Instance.ForceDriver;
  40. set => ApplicationImpl.Instance.ForceDriver = value;
  41. }
  42. /// <summary>
  43. /// Collection of sixel images to write out to screen when updating.
  44. /// Only add to this collection if you are sure terminal supports sixel format.
  45. /// </summary>
  46. public static List<SixelToRender> Sixel => ApplicationImpl.Instance.Sixel;
  47. }