From d682afcde2f9b743413c4c7a0254dd4bedd44f89 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Oct 2025 19:39:03 +0000 Subject: [PATCH 1/4] Initial plan From 9e61e8eafabe8b7208fba67f73c885ad39b85d3c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Oct 2025 19:47:07 +0000 Subject: [PATCH 2/4] Add Color property to connections and folders with inheritance support Co-authored-by: Kvarkas <3611964+Kvarkas@users.noreply.github.com> --- .../Connection/AbstractConnectionRecord.cs | 12 ++++++++++ mRemoteNG/Connection/ConnectionInfo.cs | 1 + .../Connection/ConnectionInfoInheritance.cs | 6 +++++ mRemoteNG/Language/Language.resx | 6 +++++ .../Controls/ConnectionTree/ConnectionTree.cs | 22 +++++++++++++++++++ 5 files changed, 47 insertions(+) diff --git a/mRemoteNG/Connection/AbstractConnectionRecord.cs b/mRemoteNG/Connection/AbstractConnectionRecord.cs index 74ff6e15..9a9fe488 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 f6538436..56a2e883 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 1c0e2281..fcf0a2d7 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 311c87c4..0a793b73 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 eda16cc7..b5d38574 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) From bbe1fa8416da1420acc0b21962dd4107644e0a57 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Oct 2025 19:49:21 +0000 Subject: [PATCH 3/4] Add Color property to Language.Designer.cs and add inheritance tests Co-authored-by: Kvarkas <3611964+Kvarkas@users.noreply.github.com> --- mRemoteNG/Language/Language.Designer.cs | 18 ++++++++++++++ .../ConnectionInheritanceIntegrationTests.cs | 24 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/mRemoteNG/Language/Language.Designer.cs b/mRemoteNG/Language/Language.Designer.cs index ca13aaa6..8b75827c 100644 --- a/mRemoteNG/Language/Language.Designer.cs +++ b/mRemoteNG/Language/Language.Designer.cs @@ -609,6 +609,15 @@ namespace mRemoteNG.Resources.Language { } } + /// + /// Looks up a localized string similar to Color. + /// + internal static string Color { + get { + return ResourceManager.GetString("Color", resourceCulture); + } + } + /// /// Looks up a localized string similar to Cannot start Port Scan, incorrect IP format!. /// @@ -3774,6 +3783,15 @@ namespace mRemoteNG.Resources.Language { } } + /// + /// Looks up a localized string similar to Sets the color for the connection or folder in the connections tree. Connections inherit this color from their parent folder.. + /// + internal static string PropertyDescriptionColor { + get { + return ResourceManager.GetString("PropertyDescriptionColor", resourceCulture); + } + } + /// /// Looks up a localized string similar to Select the color quality to be used.. /// diff --git a/mRemoteNGTests/IntegrationTests/ConnectionInheritanceIntegrationTests.cs b/mRemoteNGTests/IntegrationTests/ConnectionInheritanceIntegrationTests.cs index ec9c865c..6accecac 100644 --- a/mRemoteNGTests/IntegrationTests/ConnectionInheritanceIntegrationTests.cs +++ b/mRemoteNGTests/IntegrationTests/ConnectionInheritanceIntegrationTests.cs @@ -68,5 +68,29 @@ namespace mRemoteNGTests.IntegrationTests folder3.AddChild(connection); Assert.That(connection.Icon, Is.EqualTo(folder1.Icon)); } + + [Test] + public void ConnectionInheritsColorFromFolder() + { + var folder = new ContainerInfo { Color = "Red" }; + var connection = new ConnectionInfo { Inheritance = { Color = true } }; + _rootNode.AddChild(folder); + folder.AddChild(connection); + Assert.That(connection.Color, Is.EqualTo(folder.Color)); + } + + [Test] + public void CanInheritColorThroughMultipleFolderLevels() + { + var folder1 = new ContainerInfo { Color = "Blue" }; + var folder2 = new ContainerInfo { Inheritance = { Color = true } }; + var folder3 = new ContainerInfo { Inheritance = { Color = true } }; + var connection = new ConnectionInfo { Inheritance = { Color = true } }; + _rootNode.AddChild(folder1); + folder1.AddChild(folder2); + folder2.AddChild(folder3); + folder3.AddChild(connection); + Assert.That(connection.Color, Is.EqualTo(folder1.Color)); + } } } \ No newline at end of file From 0aa0b5963553ed309e2eb0f67af2a95262439e0d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Oct 2025 19:50:10 +0000 Subject: [PATCH 4/4] Add documentation for Color property in folders and inheritance Co-authored-by: Kvarkas <3611964+Kvarkas@users.noreply.github.com> --- .../folders_and_inheritance.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/mRemoteNGDocumentation/folders_and_inheritance.rst b/mRemoteNGDocumentation/folders_and_inheritance.rst index f9345fdb..4805420c 100644 --- a/mRemoteNGDocumentation/folders_and_inheritance.rst +++ b/mRemoteNGDocumentation/folders_and_inheritance.rst @@ -57,3 +57,22 @@ Only the Name and Hostname/IP properties are left over, everything else will be inherited from the parent folder. Of course you can also only let some of the properties be inherited. Just play around with this a bit and you'll get the hang of it. + +Color Property +============== +You can set a color for each connection or folder in the connections list. +This makes things clearer when you have many connections. + +To set a color: + +1. Select a connection or folder in the connections tree +2. In the properties panel, find the **Color** property under the Display category +3. Click on the color value and select a color from the color picker + +When you set a color on a folder, all connections under that folder can inherit the same color +if their Color inheritance is enabled. This provides a visual way to group and identify +related connections in the tree view. + +.. note:: + The Color property can be inherited just like other properties. Enable inheritance + in the inheritance view to have connections automatically use their parent folder's color.