Tig 11 mesi fa
parent
commit
1296f5477a

+ 1 - 0
Terminal.Gui/Configuration/SourceGenerationContext.cs

@@ -20,5 +20,6 @@ namespace Terminal.Gui;
 [JsonSerializable (typeof (Dictionary<ColorName16, string>))]
 [JsonSerializable (typeof (Dictionary<string, ThemeScope>))]
 [JsonSerializable (typeof (Dictionary<string, ColorScheme>))]
+[JsonSerializable (typeof (Dictionary<string, Color>))]
 internal partial class SourceGenerationContext : JsonSerializerContext
 { }

+ 1 - 0
Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs

@@ -485,6 +485,7 @@ public abstract class ConsoleDriver
     public virtual bool SupportsTrueColor => true;
 
     // TODO: This makes ConsoleDriver dependent on Application, which is not ideal. This should be moved to Application.
+    // BUGBUG: Application.Force16Colors should be bool? so if SupportsTrueColor and Application.Force16Colors == false, this doesn't override
     /// <summary>
     ///     Gets or sets whether the <see cref="ConsoleDriver"/> should use 16 colors instead of the default TrueColors.
     ///     See <see cref="Application.Force16Colors"/> to change this setting via <see cref="ConfigurationManager"/>.

+ 2 - 0
UICatalog/UICatalog.cs

@@ -703,6 +703,8 @@ public class UICatalogApp
 
             MiIsMouseDisabled!.Checked = Application.IsMouseDisabled;
 
+            ((CheckBox)ShForce16Colors!.CommandView!).CheckedState = Application.Force16Colors ? CheckState.Checked : CheckState.UnChecked;
+
             Application.Top!.SetNeedsDisplay ();
         }
 

+ 1 - 1
UnitTests/Configuration/SerializableConfigurationPropertyTests.cs

@@ -10,7 +10,7 @@ public class SerializableConfigurationPropertyTests
 {
 
     /// <summary>
-    ///     If this test fails, you need to add a new property with the SerializableConfigurationProperty attribute.
+    ///     If this test fails, you need to add a new property to <see cref="SourceGenerationContext"/> to support serialization of the new property type.
     /// </summary>
     [Fact]
     public void Test_SerializableConfigurationProperty_Types_Added_To_JsonSerializerContext ()