Driver.cs 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. namespace Terminal.Gui.Drivers;
  2. /// <summary>
  3. /// Holds global driver settings.
  4. /// </summary>
  5. public sealed class Driver
  6. {
  7. private static bool _force16Colors = false; // Resources/config.json overrides
  8. // NOTE: Force16Colors is a configuration property (Driver.Force16Colors).
  9. // NOTE: IDriver also has a Force16Colors property, which is an instance property
  10. // NOTE: set whenever this static property is set.
  11. /// <summary>
  12. /// Determines if driver instances should use 16 colors instead of the default TrueColors.
  13. /// </summary>
  14. /// <seealso cref="IDriver.Force16Colors"/>
  15. [ConfigurationProperty (Scope = typeof (SettingsScope))]
  16. public static bool Force16Colors
  17. {
  18. get => _force16Colors;
  19. set
  20. {
  21. bool oldValue = _force16Colors;
  22. _force16Colors = value;
  23. Force16ColorsChanged?.Invoke (null, new ValueChangedEventArgs<bool> (oldValue, _force16Colors));
  24. }
  25. }
  26. /// <summary>Raised when <see cref="Force16Colors"/> changes.</summary>
  27. public static event EventHandler<ValueChangedEventArgs<bool>>? Force16ColorsChanged;
  28. }