diff --git a/mRemoteNG/Connection/AbstractConnectionRecord.cs b/mRemoteNG/Connection/AbstractConnectionRecord.cs
index 74ff6e15a..9a9fe488b 100644
--- a/mRemoteNG/Connection/AbstractConnectionRecord.cs
+++ b/mRemoteNG/Connection/AbstractConnectionRecord.cs
@@ -22,6 +22,7 @@ namespace mRemoteNG.Connection
private string _description;
private string _icon;
private string _panel;
+ private string _color;
private string _hostname;
private ExternalAddressProvider _externalAddressProvider;
@@ -153,6 +154,17 @@ namespace mRemoteNG.Connection
set => SetField(ref _panel, value, "Panel");
}
+ [LocalizedAttributes.LocalizedCategory(nameof(Language.Display)),
+ LocalizedAttributes.LocalizedDisplayName(nameof(Language.Color)),
+ LocalizedAttributes.LocalizedDescription(nameof(Language.PropertyDescriptionColor)),
+ Editor(typeof(System.Drawing.Design.ColorEditor), typeof(System.Drawing.Design.UITypeEditor)),
+ TypeConverter(typeof(System.Drawing.ColorConverter))]
+ public virtual string Color
+ {
+ get => GetPropertyValue("Color", _color);
+ set => SetField(ref _color, value, "Color");
+ }
+
#endregion
#region Connection
diff --git a/mRemoteNG/Connection/ConnectionInfo.cs b/mRemoteNG/Connection/ConnectionInfo.cs
index f65384368..56a2e8838 100644
--- a/mRemoteNG/Connection/ConnectionInfo.cs
+++ b/mRemoteNG/Connection/ConnectionInfo.cs
@@ -289,6 +289,7 @@ namespace mRemoteNG.Connection
Description = Settings.Default.ConDefaultDescription;
Icon = Settings.Default.ConDefaultIcon;
Panel = Language.General;
+ Color = string.Empty;
}
private void SetConnectionDefaults()
diff --git a/mRemoteNG/Connection/ConnectionInfoInheritance.cs b/mRemoteNG/Connection/ConnectionInfoInheritance.cs
index 1c0e2281f..fcf0a2d73 100644
--- a/mRemoteNG/Connection/ConnectionInfoInheritance.cs
+++ b/mRemoteNG/Connection/ConnectionInfoInheritance.cs
@@ -50,6 +50,12 @@ namespace mRemoteNG.Connection
TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
public bool Panel { get; set; }
+ [LocalizedAttributes.LocalizedCategory(nameof(Language.Display), 2),
+ LocalizedAttributes.LocalizedDisplayNameInherit(nameof(Language.Color)),
+ LocalizedAttributes.LocalizedDescriptionInherit(nameof(Language.PropertyDescriptionColor)),
+ TypeConverter(typeof(MiscTools.YesNoTypeConverter))]
+ public bool Color { get; set; }
+
#endregion
#region Connection
diff --git a/mRemoteNG/Language/Language.resx b/mRemoteNG/Language/Language.resx
index 311c87c40..0a793b73c 100644
--- a/mRemoteNG/Language/Language.resx
+++ b/mRemoteNG/Language/Language.resx
@@ -1020,6 +1020,9 @@ If you run into such an error, please create a new connection file!
Sets the panel in which the connection will open.
+
+ Sets the color for the connection or folder in the connections tree. Connections inherit this color from their parent folder.
+
Enter your password.
@@ -1137,6 +1140,9 @@ If you run into such an error, please create a new connection file!
Cache Bitmaps
+
+ Color
+
Colors
diff --git a/mRemoteNG/UI/Controls/ConnectionTree/ConnectionTree.cs b/mRemoteNG/UI/Controls/ConnectionTree/ConnectionTree.cs
index eda16cc70..b5d385745 100644
--- a/mRemoteNG/UI/Controls/ConnectionTree/ConnectionTree.cs
+++ b/mRemoteNG/UI/Controls/ConnectionTree/ConnectionTree.cs
@@ -166,6 +166,7 @@ namespace mRemoteNG.UI.Controls.ConnectionTree
ModelDropped += _dragAndDropHandler.HandleEvent_ModelDropped;
BeforeLabelEdit += OnBeforeLabelEdit;
AfterLabelEdit += OnAfterLabelEdit;
+ FormatCell += ConnectionTree_FormatCell;
}
///
@@ -512,6 +513,27 @@ namespace mRemoteNG.UI.Controls.ConnectionTree
_contextMenu.DisableShortcutKeys();
}
+ private void ConnectionTree_FormatCell(object sender, FormatCellEventArgs e)
+ {
+ if (e.Model is not ConnectionInfo connectionInfo)
+ return;
+
+ string colorString = connectionInfo.Color;
+ if (string.IsNullOrEmpty(colorString))
+ return;
+
+ try
+ {
+ System.Drawing.ColorConverter converter = new();
+ System.Drawing.Color color = (System.Drawing.Color)converter.ConvertFromString(colorString);
+ e.SubItem.ForeColor = color;
+ }
+ catch
+ {
+ // If color parsing fails, just ignore and use default color
+ }
+ }
+
private void OnAfterLabelEdit(object sender, LabelEditEventArgs e)
{
if (!_nodeInEditMode)