瀏覽代碼

Simplify this

Brandon Thetford 1 年之前
父節點
當前提交
166930101a
共有 1 個文件被更改,包括 2 次插入10 次删除
  1. 2 10
      Terminal.Gui/Drawing/Attribute.cs

+ 2 - 10
Terminal.Gui/Drawing/Attribute.cs

@@ -72,16 +72,8 @@ public readonly struct Attribute : IEquatable<Attribute>, IEqualityOperators<Att
         Foreground = foreground;
         Foreground = foreground;
         Background = background;
         Background = background;
 
 
-        // TODO: Once CursesDriver supports truecolor all the PlatformColor stuff goes away
-        if (Application.Driver is null)
-        {
-            PlatformColor = -1;
-
-            return;
-        }
-
-        Attribute make = Application.Driver.MakeColor (foreground, background);
-        PlatformColor = make.PlatformColor;
+        // TODO: Once CursesDriver supports true color all the PlatformColor stuff goes away
+        PlatformColor = Application.Driver?.MakeColor(in foreground, in background).PlatformColor ?? -1;
     }
     }
 
 
     /// <summary>
     /// <summary>