Implemented colors based on the unreal engines blueprints
Some checks failed
Build / build (push) Has been cancelled
Some checks failed
Build / build (push) Has been cancelled
This commit is contained in:
@@ -59,7 +59,7 @@ namespace Nodify.Calculator
|
|||||||
set => SetProperty(ref _anchor, value);
|
set => SetProperty(ref _anchor, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private System.Drawing.Color _color = System.Drawing.Color.DodgerBlue;
|
private System.Drawing.Color _color = NodeColors.Default;
|
||||||
public System.Drawing.Color ConnectorColor
|
public System.Drawing.Color ConnectorColor
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
@@ -144,23 +144,23 @@ namespace Nodify.Calculator
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a color based on the C# data type.
|
/// Returns an Unreal Engine-inspired color based on the C# data type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static System.Drawing.Color GetColorForType(string typeName)
|
public static System.Drawing.Color GetColorForType(string typeName)
|
||||||
{
|
{
|
||||||
return (typeName ?? "").ToLower() switch
|
return (typeName ?? "").ToLower() switch
|
||||||
{
|
{
|
||||||
"string" => System.Drawing.Color.CornflowerBlue,
|
"string" => NodeColors.String,
|
||||||
"int" => System.Drawing.Color.LightGreen,
|
"int" => NodeColors.Integer,
|
||||||
"double" => System.Drawing.Color.Orange,
|
"double" => NodeColors.Float,
|
||||||
"float" => System.Drawing.Color.Gold,
|
"float" => NodeColors.Float,
|
||||||
"bool" => System.Drawing.Color.Tomato,
|
"bool" => NodeColors.Boolean,
|
||||||
"decimal" => System.Drawing.Color.MediumOrchid,
|
"decimal" => NodeColors.Decimal,
|
||||||
"long" => System.Drawing.Color.YellowGreen,
|
"long" => NodeColors.Long,
|
||||||
"datetime" => System.Drawing.Color.DeepSkyBlue,
|
"datetime" => NodeColors.DateTime,
|
||||||
"object" => System.Drawing.Color.Silver,
|
"object" => NodeColors.Object,
|
||||||
"list<object>" => System.Drawing.Color.Plum,
|
"list<object>" => NodeColors.List,
|
||||||
_ => System.Drawing.Color.LightGray,
|
_ => NodeColors.Default,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
70
Examples/Nodify.Calculator/NodeColors.cs
Normal file
70
Examples/Nodify.Calculator/NodeColors.cs
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace Nodify.Calculator
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Centralized color palette inspired by Unreal Engine Blueprint visual scripting.
|
||||||
|
/// All connector and node colors should reference these constants for consistency.
|
||||||
|
/// </summary>
|
||||||
|
public static class NodeColors
|
||||||
|
{
|
||||||
|
// ─── Variable / Data Type Pin Colors (Unreal Engine style) ───
|
||||||
|
|
||||||
|
/// <summary>Boolean (True/False) — Red</summary>
|
||||||
|
public static readonly Color Boolean = Color.FromArgb(255, 200, 50, 50);
|
||||||
|
|
||||||
|
/// <summary>Integer — Light Blue</summary>
|
||||||
|
public static readonly Color Integer = Color.FromArgb(255, 100, 220, 200);
|
||||||
|
|
||||||
|
/// <summary>Float / Double — Bright Green</summary>
|
||||||
|
public static readonly Color Float = Color.FromArgb(255, 120, 255, 100);
|
||||||
|
|
||||||
|
/// <summary>String — Magenta / Pink</summary>
|
||||||
|
public static readonly Color String = Color.FromArgb(255, 255, 50, 150);
|
||||||
|
|
||||||
|
/// <summary>Long / Name — Gold / Yellow-Green</summary>
|
||||||
|
public static readonly Color Long = Color.FromArgb(255, 200, 200, 50);
|
||||||
|
|
||||||
|
/// <summary>Decimal — Orange (like Transform/Struct in UE)</summary>
|
||||||
|
public static readonly Color Decimal = Color.FromArgb(255, 230, 150, 50);
|
||||||
|
|
||||||
|
/// <summary>DateTime — Cyan (like Rotator in UE)</summary>
|
||||||
|
public static readonly Color DateTime = Color.FromArgb(255, 50, 200, 220);
|
||||||
|
|
||||||
|
/// <summary>Object (generic / untyped) — Gray</summary>
|
||||||
|
public static readonly Color Object = Color.FromArgb(255, 160, 160, 160);
|
||||||
|
|
||||||
|
// ─── Connector Shape Colors ───
|
||||||
|
|
||||||
|
/// <summary>Model / Class reference — Purple (like Class references in UE)</summary>
|
||||||
|
public static readonly Color Model = Color.FromArgb(255, 150, 80, 220);
|
||||||
|
|
||||||
|
/// <summary>List / Array — Green (Grid connectors)</summary>
|
||||||
|
public static readonly Color List = Color.FromArgb(255, 50, 220, 130);
|
||||||
|
|
||||||
|
// ─── Execution Flow Colors ───
|
||||||
|
|
||||||
|
/// <summary>Execution / Flow pins (Triangle) — White (like UE exec pins)</summary>
|
||||||
|
public static readonly Color Exec = Color.White;
|
||||||
|
|
||||||
|
/// <summary>Begin / End special flow — Red (like Event nodes in UE)</summary>
|
||||||
|
public static readonly Color Event = Color.FromArgb(255, 200, 30, 30);
|
||||||
|
|
||||||
|
/// <summary>Loop body flow — Teal/Green branch</summary>
|
||||||
|
public static readonly Color LoopFlow = Color.FromArgb(255, 50, 220, 130);
|
||||||
|
|
||||||
|
// ─── Node Connector Defaults ───
|
||||||
|
|
||||||
|
/// <summary>Universal / Copy / Untyped connector — White</summary>
|
||||||
|
public static readonly Color Universal = Color.White;
|
||||||
|
|
||||||
|
/// <summary>Default connector color for unknown types</summary>
|
||||||
|
public static readonly Color Default = Color.FromArgb(255, 180, 180, 180);
|
||||||
|
|
||||||
|
/// <summary>API param input — Teal</summary>
|
||||||
|
public static readonly Color ApiParam = Color.FromArgb(255, 100, 220, 200);
|
||||||
|
|
||||||
|
/// <summary>Generic system connector — Cyan</summary>
|
||||||
|
public static readonly Color SystemGeneric = Color.FromArgb(255, 100, 220, 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,9 +24,9 @@ namespace Nodify.Calculator.NodeHandlers
|
|||||||
SystemOperationType = info.sysOp
|
SystemOperationType = info.sysOp
|
||||||
};
|
};
|
||||||
if (info.sysOp == SystemOperations.BEGIN)
|
if (info.sysOp == SystemOperations.BEGIN)
|
||||||
op.Output.Add(new ConnectorViewModel { Title = "", IsInput = false, Shape = ConnectorShape.Triangle, ConnectorColor = Color.DarkRed });
|
op.Output.Add(new ConnectorViewModel { Title = "", IsInput = false, Shape = ConnectorShape.Triangle, ConnectorColor = NodeColors.Event });
|
||||||
else
|
else
|
||||||
op.Input.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Triangle, ConnectorColor = Color.DarkRed });
|
op.Input.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Triangle, ConnectorColor = NodeColors.Event });
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ namespace Nodify.Calculator.NodeHandlers
|
|||||||
Title = info.Title ?? "COPY",
|
Title = info.Title ?? "COPY",
|
||||||
SystemOperationType = SystemOperations.COPY
|
SystemOperationType = SystemOperations.COPY
|
||||||
};
|
};
|
||||||
op.Input.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Circle, ConnectorColor = Color.White, IsCopyConnector = true });
|
op.Input.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Circle, ConnectorColor = NodeColors.Universal, IsCopyConnector = true });
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ namespace Nodify.Calculator.NodeHandlers
|
|||||||
Title = info.Title ?? "Split",
|
Title = info.Title ?? "Split",
|
||||||
SystemOperationType = SystemOperations.SPLIT
|
SystemOperationType = SystemOperations.SPLIT
|
||||||
};
|
};
|
||||||
op.Input.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Square, ConnectorColor = Color.MediumPurple });
|
op.Input.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Square, ConnectorColor = NodeColors.Model });
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace Nodify.Calculator.NodeHandlers
|
|||||||
};
|
};
|
||||||
op.Input.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Triangle });
|
op.Input.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Triangle });
|
||||||
op.Output.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Triangle, IsInput = false });
|
op.Output.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Triangle, IsInput = false });
|
||||||
op.Input.Add(new ConnectorViewModel { Title = "Value", ConnectorColor = Color.LimeGreen });
|
op.Input.Add(new ConnectorViewModel { Title = "Value", ConnectorColor = NodeColors.Object });
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ namespace Nodify.Calculator.NodeHandlers
|
|||||||
{
|
{
|
||||||
Title = "List",
|
Title = "List",
|
||||||
Shape = ConnectorShape.Circle,
|
Shape = ConnectorShape.Circle,
|
||||||
ConnectorColor = Color.White,
|
ConnectorColor = NodeColors.Universal,
|
||||||
IsCopyConnector = true,
|
IsCopyConnector = true,
|
||||||
IsTakeListConnector = true
|
IsTakeListConnector = true
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ namespace Nodify.Calculator.NodeHandlers
|
|||||||
Title = info.ClassName ?? "",
|
Title = info.ClassName ?? "",
|
||||||
IsInput = false,
|
IsInput = false,
|
||||||
Shape = ConnectorShape.Square,
|
Shape = ConnectorShape.Square,
|
||||||
ConnectorColor = Color.MediumPurple,
|
ConnectorColor = NodeColors.Model,
|
||||||
DataType = info.ClassName ?? "object"
|
DataType = info.ClassName ?? "object"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ namespace Nodify.Calculator.NodeHandlers
|
|||||||
var properties = OperationFactory.GetPropertiesFromClassPublic(fileContent);
|
var properties = OperationFactory.GetPropertiesFromClassPublic(fileContent);
|
||||||
|
|
||||||
// Square input for the class object
|
// Square input for the class object
|
||||||
op.Input.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Square, ConnectorColor = Color.MediumPurple });
|
op.Input.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Square, ConnectorColor = NodeColors.Model });
|
||||||
|
|
||||||
// Circle output per property, colored by type
|
// Circle output per property, colored by type
|
||||||
foreach (var property in properties)
|
foreach (var property in properties)
|
||||||
@@ -164,13 +164,13 @@ namespace Nodify.Calculator.NodeHandlers
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Fallback: generic square I/O
|
// Fallback: generic square I/O
|
||||||
op.Input.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Square, ConnectorColor = Color.MediumPurple });
|
op.Input.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Square, ConnectorColor = NodeColors.Model });
|
||||||
op.Output.Add(new ConnectorViewModel
|
op.Output.Add(new ConnectorViewModel
|
||||||
{
|
{
|
||||||
Title = info.ClassName ?? "",
|
Title = info.ClassName ?? "",
|
||||||
IsInput = false,
|
IsInput = false,
|
||||||
Shape = ConnectorShape.Square,
|
Shape = ConnectorShape.Square,
|
||||||
ConnectorColor = Color.MediumPurple,
|
ConnectorColor = NodeColors.Model,
|
||||||
DataType = info.ClassName ?? "object"
|
DataType = info.ClassName ?? "object"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ namespace Nodify.Calculator.NodeHandlers
|
|||||||
Title = rc,
|
Title = rc,
|
||||||
IsInput = false,
|
IsInput = false,
|
||||||
Shape = ConnectorShape.Grid,
|
Shape = ConnectorShape.Grid,
|
||||||
ConnectorColor = Color.MediumSpringGreen,
|
ConnectorColor = NodeColors.List,
|
||||||
DataType = rc
|
DataType = rc
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -137,7 +137,7 @@ namespace Nodify.Calculator.NodeHandlers
|
|||||||
Title = "Response",
|
Title = "Response",
|
||||||
IsInput = false,
|
IsInput = false,
|
||||||
Shape = ConnectorShape.Circle,
|
Shape = ConnectorShape.Circle,
|
||||||
ConnectorColor = Color.LimeGreen,
|
ConnectorColor = NodeColors.Object,
|
||||||
DataType = "object"
|
DataType = "object"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -154,7 +154,7 @@ namespace Nodify.Calculator.NodeHandlers
|
|||||||
{
|
{
|
||||||
Title = $"Body ({bc})",
|
Title = $"Body ({bc})",
|
||||||
Shape = isList ? ConnectorShape.Grid : ConnectorShape.Square,
|
Shape = isList ? ConnectorShape.Grid : ConnectorShape.Square,
|
||||||
ConnectorColor = isList ? Color.MediumSpringGreen : Color.MediumPurple,
|
ConnectorColor = isList ? NodeColors.List : NodeColors.Model,
|
||||||
DataType = bc
|
DataType = bc
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -164,7 +164,7 @@ namespace Nodify.Calculator.NodeHandlers
|
|||||||
{
|
{
|
||||||
Title = "Body",
|
Title = "Body",
|
||||||
Shape = ConnectorShape.Circle,
|
Shape = ConnectorShape.Circle,
|
||||||
ConnectorColor = Color.LimeGreen,
|
ConnectorColor = NodeColors.Object,
|
||||||
DataType = "object"
|
DataType = "object"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -173,7 +173,7 @@ namespace Nodify.Calculator.NodeHandlers
|
|||||||
// Other data inputs (query/path params)
|
// Other data inputs (query/path params)
|
||||||
foreach (var label in info.Input)
|
foreach (var label in info.Input)
|
||||||
{
|
{
|
||||||
op.Input.Add(new ConnectorViewModel { Title = label, ConnectorColor = Color.LimeGreen });
|
op.Input.Add(new ConnectorViewModel { Title = label, ConnectorColor = NodeColors.ApiParam });
|
||||||
}
|
}
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user