[NUI] Remove UIColor constructor with vector4 and etc.
authorJiyun Yang <ji.yang@samsung.com>
Fri, 14 Mar 2025 07:34:55 +0000 (16:34 +0900)
committerJaehyun Cho <jaehyun0cho@gmail.com>
Tue, 1 Apr 2025 11:52:37 +0000 (20:52 +0900)
* Remove UIColor constructor with vector4 type.
* Add predefined colors: Yellow, Cyan, Magenta, Gray

Signed-off-by: Jiyun Yang <ji.yang@samsung.com>
src/Tizen.NUI.Extension/Markup/TextEditorExtensions.cs
src/Tizen.NUI.Extension/Markup/TextFieldExtensions.cs
src/Tizen.NUI.Extension/Markup/TextLabelExtensions.cs
src/Tizen.NUI.Extension/Markup/ViewExtensions.cs
src/Tizen.NUI/src/devel/Lite/UIColor.cs
src/Tizen.NUI/src/internal/Common/Object.cs
src/Tizen.NUI/src/public/BaseComponents/ViewLiteProperty.cs

index 9362ccaa32d7a0b138286e2b99af77970fdde049..01d56ee197873e0ac2c83bc51eadc6243b59d25f 100644 (file)
@@ -894,7 +894,7 @@ namespace Tizen.NUI.Extension
         public static UIColor TextColor(this TextEditor view)
         {
             //FIXME: we need to set UI value type directly without converting reference value.
-            return new UIColor(view.TextColor);
+            return UIColor.From(view.TextColor);
         }
 
         /// <summary>
@@ -905,7 +905,7 @@ namespace Tizen.NUI.Extension
         public static UIColor PlaceholderTextColor(this TextEditor view)
         {
             //FIXME: we need to set UI value type directly without converting reference value.
-            return new UIColor(view.PlaceholderTextColor);
+            return UIColor.From(view.PlaceholderTextColor);
         }
 
         /// <summary>
@@ -916,7 +916,7 @@ namespace Tizen.NUI.Extension
         public static UIColor PrimaryCursorColor(this TextEditor view)
         {
             //FIXME: we need to set UI value type directly without converting reference value.
-            return new UIColor(view.PrimaryCursorColor);
+            return UIColor.From(view.PrimaryCursorColor);
         }
 
         /// <summary>
@@ -927,7 +927,7 @@ namespace Tizen.NUI.Extension
         public static UIColor SecondaryCursorColor(this TextEditor view)
         {
             //FIXME: we need to set UI value type directly without converting reference value.
-            return new UIColor(view.SecondaryCursorColor);
+            return UIColor.From(view.SecondaryCursorColor);
         }
 
         /// <summary>
@@ -938,7 +938,7 @@ namespace Tizen.NUI.Extension
         public static UIColor SelectionHighlightColor(this TextEditor view)
         {
             //FIXME: we need to set UI value type directly without converting reference value.
-            return new UIColor(view.SelectionHighlightColor);
+            return UIColor.From(view.SelectionHighlightColor);
         }
 
         /// <summary>
@@ -949,7 +949,7 @@ namespace Tizen.NUI.Extension
         public static UIColor InputColor(this TextEditor view)
         {
             //FIXME: we need to set UI value type directly without converting reference value.
-            return new UIColor(view.InputColor);
+            return UIColor.From(view.InputColor);
         }
     }
 }
index 4afd7756a05c3fcac51d54a0fada628dd30be54c..dc86680398dcb7cefde83f7a25e04ab4d6da3656 100644 (file)
@@ -867,7 +867,7 @@ namespace Tizen.NUI.Extension
         public static UIColor TextColor(this TextField view)
         {
             //FIXME: we need to set UI value type directly without converting reference value.
-            return new UIColor(view.TextColor);
+            return UIColor.From(view.TextColor);
         }
 
         /// <summary>
@@ -878,7 +878,7 @@ namespace Tizen.NUI.Extension
         public static UIColor PlaceholderTextColor(this TextField view)
         {
             //FIXME: we need to set UI value type directly without converting reference value.
-            return new UIColor(view.PlaceholderTextColor);
+            return UIColor.From(view.PlaceholderTextColor);
         }
 
         /// <summary>
@@ -889,7 +889,7 @@ namespace Tizen.NUI.Extension
         public static UIColor PrimaryCursorColor(this TextField view)
         {
             //FIXME: we need to set UI value type directly without converting reference value.
-            return new UIColor(view.PrimaryCursorColor);
+            return UIColor.From(view.PrimaryCursorColor);
         }
 
         /// <summary>
@@ -900,7 +900,7 @@ namespace Tizen.NUI.Extension
         public static UIColor SecondaryCursorColor(this TextField view)
         {
             //FIXME: we need to set UI value type directly without converting reference value.
-            return new UIColor(view.SecondaryCursorColor);
+            return UIColor.From(view.SecondaryCursorColor);
         }
 
         /// <summary>
@@ -911,7 +911,7 @@ namespace Tizen.NUI.Extension
         public static UIColor SelectionHighlightColor(this TextField view)
         {
             //FIXME: we need to set UI value type directly without converting reference value.
-            return new UIColor(view.SelectionHighlightColor);
+            return UIColor.From(view.SelectionHighlightColor);
         }
 
         /// <summary>
@@ -922,7 +922,7 @@ namespace Tizen.NUI.Extension
         public static UIColor InputColor(this TextField view)
         {
             //FIXME: we need to set UI value type directly without converting reference value.
-            return new UIColor(view.InputColor);
+            return UIColor.From(view.InputColor);
         }
     }
 }
index 507abb7a07eeb4e360f91e1bda4eabbfa4a25937..98277b68f50a6424b4d895835adc192594f1da15 100644 (file)
@@ -504,7 +504,7 @@ namespace Tizen.NUI.Extension
         public static UIColor TextColor(this TextLabel view)
         {
             //FIXME: we need to set UI value type directly without converting reference value.
-            return new UIColor(view.TextColor);
+            return UIColor.From(view.TextColor);
         }
     }
 }
index 0976d2870644fd1ce67dddb9588528e462db8e38..03b7eaa38c9f5d33f7858349fbf5dcafc6430631 100644 (file)
@@ -648,7 +648,7 @@ namespace Tizen.NUI.Extension
             var color = view.Color;
 
             //FIXME: we need to set UI value type directly without converting reference value.
-            return color != null ? new UIColor(color) : UIColor.Transparent;
+            return color != null ? UIColor.From(color) : UIColor.Transparent;
         }
 
         /// <summary>
@@ -693,7 +693,7 @@ namespace Tizen.NUI.Extension
             var color = view.BorderlineColor;
 
             //FIXME: we need to set UI value type directly without converting reference value.
-            return color != null ? new UIColor(color) : UIColor.Transparent;
+            return color != null ? UIColor.From(color) : UIColor.Transparent;
         }
     }
 }
index 48d7d7af0e5082ecce644b5c2b62ebae5f0ee384..d145dcc3c4865d9faed4cb8dcc439c62b47b954c 100644 (file)
@@ -46,6 +46,11 @@ namespace Tizen.NUI
         /// </summary>
         public static readonly UIColor White = new (1, 1, 1, 1);
 
+        /// <summary>
+        /// The gray color.
+        /// </summary>
+        public static readonly UIColor Gray = new (0.5f, 0.5f, 0.5f, 1);
+
         /// <summary>
         /// The red color.
         /// </summary>
@@ -61,6 +66,21 @@ namespace Tizen.NUI
         /// </summary>
         public static readonly UIColor Blue = new (0, 0, 1, 1);
 
+        /// <summary>
+        /// The yellow color.
+        /// </summary>
+        public static readonly UIColor Yellow = new (1, 1, 0, 1);
+
+        /// <summary>
+        /// The cyan color.
+        /// </summary>
+        public static readonly UIColor Cyan = new (0, 1, 1, 1);
+
+        /// <summary>
+        /// The magenta color.
+        /// </summary>
+        public static readonly UIColor Magenta = new (1, 0, 1, 1);
+
         private float _r; // multiply alpha for token
         private float _g; // fixed alpha for token
         private float _b;
@@ -123,10 +143,6 @@ namespace Tizen.NUI
             _tokenId = tokenId;
         }
 
-        internal UIColor(NUI.Vector4 vector4) : this(vector4.X, vector4.Y, vector4.Z, vector4.W)
-        {
-        }
-
         /// <summary>
         /// Gets a value indicating whether this is default.
         /// </summary>
@@ -231,6 +247,8 @@ namespace Tizen.NUI
         /// <param name="id">The unique identifier of the token.</param>
         public static UIColor Token(string id) => new (id, 1f);
 
+        internal static UIColor From(NUI.Vector4 vector4) => new UIColor(vector4.X, vector4.Y, vector4.Z, vector4.W);
+
         /// <summary>
         /// Compares two UIColor for equality.
         /// </summary>
index c44467b7df4c073e13f5829dbc9cda917edf3fbe..b9547a394172f5e4b6070289180d1aed90cf4f6e 100755 (executable)
@@ -361,7 +361,7 @@ namespace Tizen.NUI
                 vector4.Reset();
                 _ = Interop.View.InternalRetrievingVisualPropertyVector4(actor, visualIndex, visualPropertyIndex, vector4.SwigCPtr);
                 NDalicPINVOKE.ThrowExceptionIfExists();
-                return new UIColor(vector4);
+                return UIColor.From(vector4);
             }, actor, visualIndex, visualPropertyIndex);
         }
 
index 67a2c67b5f66cc4febd9ec53350d9405e067ce05..f2addb5ece96ab729d729e9b980e35739a3dcdf6 100755 (executable)
@@ -80,7 +80,7 @@ namespace Tizen.NUI.BaseComponents
                     var shadow = new Shadow(map);
                     return new UIShadow()
                     {
-                        Color = new UIColor(shadow.Color),
+                        Color = UIColor.From(shadow.Color),
                         BlurRadius = shadow.BlurRadius,
                         OffsetX = shadow.Offset.X,
                         OffsetY = shadow.Offset.Y,