Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When adding a new combo colour, use the last colour as a starting point #30110

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion osu.Game/Graphics/UserInterfaceV2/FormColourPalette.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.Collections.Specialized;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
Expand All @@ -19,6 +20,7 @@
using osu.Game.Overlays;
using osu.Game.Resources.Localisation.Web;
using osuTK;
using osuTK.Graphics;

namespace osu.Game.Graphics.UserInterfaceV2
{
Expand Down Expand Up @@ -76,7 +78,7 @@ private void load()
Spacing = new Vector2(5),
Child = button = new RoundedButton
{
Action = () => Colours.Add(Colour4.White),
Action = addNewColour,
Size = new Vector2(70),
Text = "+",
}
Expand Down Expand Up @@ -112,6 +114,16 @@ protected override void OnHoverLost(HoverLostEvent e)
updateState();
}

private void addNewColour()
{
Color4 startingColour = Colours.Count > 0
? Colours.Last()
: Colour4.White;

Colours.Add(startingColour);
flow.OfType<ColourButton>().Last().TriggerClick();
}

private void updateState()
{
background.Colour = colourProvider.Background5;
Expand Down
Loading