Implemented colors based on the unreal engines blueprints
Some checks failed
Build / build (push) Has been cancelled

This commit is contained in:
Ankitkumar Satapara
2026-04-23 14:53:41 +05:30
parent 361c1bb8c4
commit abb2c0a095
6 changed files with 98 additions and 28 deletions

View File

@@ -59,7 +59,7 @@ namespace Nodify.Calculator
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
{
set
@@ -144,23 +144,23 @@ namespace Nodify.Calculator
}
/// <summary>
/// Returns a color based on the C# data type.
/// Returns an Unreal Engine-inspired color based on the C# data type.
/// </summary>
public static System.Drawing.Color GetColorForType(string typeName)
{
return (typeName ?? "").ToLower() switch
{
"string" => System.Drawing.Color.CornflowerBlue,
"int" => System.Drawing.Color.LightGreen,
"double" => System.Drawing.Color.Orange,
"float" => System.Drawing.Color.Gold,
"bool" => System.Drawing.Color.Tomato,
"decimal" => System.Drawing.Color.MediumOrchid,
"long" => System.Drawing.Color.YellowGreen,
"datetime" => System.Drawing.Color.DeepSkyBlue,
"object" => System.Drawing.Color.Silver,
"list<object>" => System.Drawing.Color.Plum,
_ => System.Drawing.Color.LightGray,
"string" => NodeColors.String,
"int" => NodeColors.Integer,
"double" => NodeColors.Float,
"float" => NodeColors.Float,
"bool" => NodeColors.Boolean,
"decimal" => NodeColors.Decimal,
"long" => NodeColors.Long,
"datetime" => NodeColors.DateTime,
"object" => NodeColors.Object,
"list<object>" => NodeColors.List,
_ => NodeColors.Default,
};
}
}

View 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);
}
}

View File

@@ -24,9 +24,9 @@ namespace Nodify.Calculator.NodeHandlers
SystemOperationType = info.sysOp
};
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
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;
}
@@ -65,7 +65,7 @@ namespace Nodify.Calculator.NodeHandlers
Title = info.Title ?? "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;
}
@@ -118,7 +118,7 @@ namespace Nodify.Calculator.NodeHandlers
Title = info.Title ?? "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;
}

View File

@@ -24,7 +24,7 @@ namespace Nodify.Calculator.NodeHandlers
};
op.Input.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Triangle });
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;
}
@@ -114,7 +114,7 @@ namespace Nodify.Calculator.NodeHandlers
{
Title = "List",
Shape = ConnectorShape.Circle,
ConnectorColor = Color.White,
ConnectorColor = NodeColors.Universal,
IsCopyConnector = true,
IsTakeListConnector = true
});

View File

@@ -126,7 +126,7 @@ namespace Nodify.Calculator.NodeHandlers
Title = info.ClassName ?? "",
IsInput = false,
Shape = ConnectorShape.Square,
ConnectorColor = Color.MediumPurple,
ConnectorColor = NodeColors.Model,
DataType = info.ClassName ?? "object"
});
}
@@ -145,7 +145,7 @@ namespace Nodify.Calculator.NodeHandlers
var properties = OperationFactory.GetPropertiesFromClassPublic(fileContent);
// 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
foreach (var property in properties)
@@ -164,13 +164,13 @@ namespace Nodify.Calculator.NodeHandlers
else
{
// 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
{
Title = info.ClassName ?? "",
IsInput = false,
Shape = ConnectorShape.Square,
ConnectorColor = Color.MediumPurple,
ConnectorColor = NodeColors.Model,
DataType = info.ClassName ?? "object"
});
}

View File

@@ -113,7 +113,7 @@ namespace Nodify.Calculator.NodeHandlers
Title = rc,
IsInput = false,
Shape = ConnectorShape.Grid,
ConnectorColor = Color.MediumSpringGreen,
ConnectorColor = NodeColors.List,
DataType = rc
});
}
@@ -137,7 +137,7 @@ namespace Nodify.Calculator.NodeHandlers
Title = "Response",
IsInput = false,
Shape = ConnectorShape.Circle,
ConnectorColor = Color.LimeGreen,
ConnectorColor = NodeColors.Object,
DataType = "object"
});
}
@@ -154,7 +154,7 @@ namespace Nodify.Calculator.NodeHandlers
{
Title = $"Body ({bc})",
Shape = isList ? ConnectorShape.Grid : ConnectorShape.Square,
ConnectorColor = isList ? Color.MediumSpringGreen : Color.MediumPurple,
ConnectorColor = isList ? NodeColors.List : NodeColors.Model,
DataType = bc
});
}
@@ -164,7 +164,7 @@ namespace Nodify.Calculator.NodeHandlers
{
Title = "Body",
Shape = ConnectorShape.Circle,
ConnectorColor = Color.LimeGreen,
ConnectorColor = NodeColors.Object,
DataType = "object"
});
}
@@ -173,7 +173,7 @@ namespace Nodify.Calculator.NodeHandlers
// Other data inputs (query/path params)
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;
}