diff --git a/src/Perspex.Controls/Presenters/TextPresenter.cs b/src/Perspex.Controls/Presenters/TextPresenter.cs index d594d6495b..4d1dccfb52 100644 --- a/src/Perspex.Controls/Presenters/TextPresenter.cs +++ b/src/Perspex.Controls/Presenters/TextPresenter.cs @@ -93,7 +93,17 @@ namespace Perspex.Controls.Presenters if (selectionStart == selectionEnd) { var charPos = FormattedText.HitTestTextPosition(CaretIndex); - Brush caretBrush = Brushes.Black; + + var background = this.GetVisualAncestors() + .OfType() + .FirstOrDefault(x => x.IsSet(BackgroundProperty)) + ?.GetValue(BackgroundProperty) as SolidColorBrush; + + byte red = (byte)~(background.Color.R); + byte green = (byte)~(background.Color.G); + byte blue = (byte)~(background.Color.B); + + var caretBrush = new SolidColorBrush(Color.FromRgb(red, green, blue)); if (_caretBlink) {