diff --git a/src/System.Windows.Forms.Design/src/System/Drawing/Design/ColorEditor.ColorUI.cs b/src/System.Windows.Forms.Design/src/System/Drawing/Design/ColorEditor.ColorUI.cs index 4e693dc32eb..66475d0f876 100644 --- a/src/System.Windows.Forms.Design/src/System/Drawing/Design/ColorEditor.ColorUI.cs +++ b/src/System.Windows.Forms.Design/src/System/Drawing/Design/ColorEditor.ColorUI.cs @@ -274,7 +274,14 @@ private void OnListDrawItem(object? sender, DrawItemEventArgs die) _editor.PaintValue(value, graphics, new Rectangle(die.Bounds.X + 2, die.Bounds.Y + 2, 22, die.Bounds.Height - 4)); graphics.DrawRectangle(SystemPens.WindowText, new Rectangle(die.Bounds.X + 2, die.Bounds.Y + 2, 22 - 1, die.Bounds.Height - 4 - 1)); - Brush foreBrush = new SolidBrush(die.ForeColor); + + Color textColor = die.ForeColor; + if (Application.IsDarkModeEnabled && die.State.HasFlag(DrawItemState.Selected)) + { + textColor = SystemColors.ControlText; + } + + Brush foreBrush = new SolidBrush(textColor); graphics.DrawString(value.Name, font, foreBrush, die.Bounds.X + 26, die.Bounds.Y); foreBrush.Dispose(); } diff --git a/src/System.Windows.Forms.Design/src/System/Drawing/Design/CursorEditor.CursorUI.cs b/src/System.Windows.Forms.Design/src/System/Drawing/Design/CursorEditor.CursorUI.cs index 94a4b69e153..4394ae47363 100644 --- a/src/System.Windows.Forms.Design/src/System/Drawing/Design/CursorEditor.CursorUI.cs +++ b/src/System.Windows.Forms.Design/src/System/Drawing/Design/CursorEditor.CursorUI.cs @@ -64,7 +64,14 @@ protected override void OnDrawItem(DrawItemEventArgs e) Cursor cursor = (Cursor)Items[e.Index]; string? text = _cursorConverter.ConvertToString(cursor); Font font = e.Font!; - using var brushText = e.ForeColor.GetCachedSolidBrushScope(); + + Color textColor = e.ForeColor; + if (Application.IsDarkModeEnabled && e.State.HasFlag(DrawItemState.Selected)) + { + textColor = SystemColors.ControlText; + } + + using var brushText = textColor.GetCachedSolidBrushScope(); var cursorWidth = ScaleHelper.ScaleSmallIconToDpi(Icon.FromHandle(cursor.Handle), DeviceDpi).Size.Width; e.DrawBackground();