From 7bc8f5cd5cf4628626c76e65c81484b3609556a9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Oct 2021 12:59:40 +0900 Subject: [PATCH] Change selection colour to also match the colour provider scheme --- osu.Game/Graphics/UserInterface/OsuTextBox.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuTextBox.cs b/osu.Game/Graphics/UserInterface/OsuTextBox.cs index b8f8518bb4..96319b9fdd 100644 --- a/osu.Game/Graphics/UserInterface/OsuTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTextBox.cs @@ -48,6 +48,8 @@ public class OsuTextBox : BasicTextBox private Sample? textCommittedSample; private Sample? caretMovedSample; + private OsuCaret? caret; + public OsuTextBox() { Height = 40; @@ -62,8 +64,12 @@ public OsuTextBox() private void load(OverlayColourProvider? colourProvider, OsuColour colour, AudioManager audio) { BackgroundUnfocused = colourProvider?.Background5 ?? Color4.Black.Opacity(0.5f); - BackgroundFocused = colourProvider?.Background3 ?? OsuColour.Gray(0.3f).Opacity(0.8f); + BackgroundFocused = colourProvider?.Background4 ?? OsuColour.Gray(0.3f).Opacity(0.8f); BackgroundCommit = BorderColour = colourProvider?.Highlight1 ?? colour.Yellow; + selectionColour = colourProvider?.Background1 ?? new Color4(249, 90, 255, 255); + + if (caret != null) + caret.SelectionColour = selectionColour; Placeholder.Colour = colourProvider?.Foreground1 ?? new Color4(180, 180, 180, 255); @@ -76,7 +82,9 @@ private void load(OverlayColourProvider? colourProvider, OsuColour colour, Audio caretMovedSample = audio.Samples.Get(@"Keyboard/key-movement"); } - protected override Color4 SelectionColour => new Color4(249, 90, 255, 255); + private Color4 selectionColour; + + protected override Color4 SelectionColour => selectionColour; protected override void OnUserTextAdded(string added) { @@ -128,7 +136,7 @@ protected override void OnFocusLost(FocusLostEvent e) Child = new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) }, }; - protected override Caret CreateCaret() => new OsuCaret + protected override Caret CreateCaret() => caret = new OsuCaret { CaretWidth = CaretWidth, SelectionColour = SelectionColour,