瀏覽代碼

WIP: Color deserialization is broken

Tig Kindel 1 年之前
父節點
當前提交
52ab5e50bb
共有 2 個文件被更改,包括 5 次插入8 次删除
  1. 5 5
      Terminal.Gui/Drawing/Color.cs
  2. 0 3
      UICatalog/UICatalog.cs

+ 5 - 5
Terminal.Gui/Drawing/Color.cs

@@ -15,7 +15,6 @@ namespace Terminal.Gui {
 	/// <remarks>
 	/// The <see cref="Attribute.HasValidColors"/> value indicates either no-color has been set or the color is invalid.
 	/// </remarks>
-	[JsonConverter (typeof (ColorJsonConverter))]
 	public enum ColorNames {
 		/// <summary>
 		/// The black color.
@@ -83,6 +82,7 @@ namespace Terminal.Gui {
 		White
 	}
 
+	[JsonConverter (typeof (ColorJsonConverter))]
 	public class Color {
 		public Color (ColorNames colorName)
 		{
@@ -474,8 +474,8 @@ namespace Terminal.Gui {
 		{
 			Foreground = foreground;
 			Background = background;
-			//TrueColorForeground = TrueColor.FromColorName (foreground);
-			//TrueColorBackground = TrueColor.FromColorName (background);
+			TrueColorForeground = TrueColor.FromColorName ((ColorNames)foreground.Value);
+			TrueColorBackground = TrueColor.FromColorName ((ColorNames)background.Value);
 			Value = value;
 			Initialized = true;
 		}
@@ -489,8 +489,8 @@ namespace Terminal.Gui {
 		{
 			Foreground = foreground;
 			Background = background;
-			//TrueColorForeground = TrueColor.FromColorName (foreground);
-			//TrueColorBackground = TrueColor.FromColorName (background);
+			TrueColorForeground = TrueColor.FromColorName ((ColorNames)foreground.Value);
+			TrueColorBackground = TrueColor.FromColorName ((ColorNames)background.Value);
 
 			var make = Make (foreground, background);
 			Initialized = make.Initialized;

+ 0 - 3
UICatalog/UICatalog.cs

@@ -50,9 +50,6 @@ namespace UICatalog {
 	/// </para>	
 	/// </remarks>
 	class UICatalogApp {
-		//[SerializableConfigurationProperty (Scope = typeof (AppScope), OmitClassName = true), JsonPropertyName ("UICatalog.StatusBar")]
-		//public static bool ShowStatusBar { get; set; } = true;
-
 		[SerializableConfigurationProperty (Scope = typeof (AppScope), OmitClassName = true), JsonPropertyName ("UICatalog.StatusBar")]
 		public static bool ShowStatusBar { get; set; } = true;