Switch Colour{Display,Palette} to use Colour4

This commit is contained in:
Bartłomiej Dach
2021-06-20 19:37:09 +02:00
parent e3e36e0a12
commit 0691c0dd63
5 changed files with 13 additions and 15 deletions

View File

@ -53,15 +53,15 @@ namespace osu.Game.Tests.Visual.UserInterface
component.Colours.AddRange(new[] component.Colours.AddRange(new[]
{ {
Color4.DarkRed, Colour4.DarkRed,
Color4.Aquamarine, Colour4.Aquamarine,
Color4.Goldenrod, Colour4.Goldenrod,
Color4.Gainsboro Colour4.Gainsboro
}); });
}); });
} }
private Color4 randomColour() => new Color4( private Colour4 randomColour() => new Color4(
RNG.NextSingle(), RNG.NextSingle(),
RNG.NextSingle(), RNG.NextSingle(),
RNG.NextSingle(), RNG.NextSingle(),

View File

@ -3,7 +3,6 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
@ -11,22 +10,21 @@ using osu.Framework.Graphics.UserInterface;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osuTK; using osuTK;
using osuTK.Graphics;
namespace osu.Game.Graphics.UserInterfaceV2 namespace osu.Game.Graphics.UserInterfaceV2
{ {
/// <summary> /// <summary>
/// A component which displays a colour along with related description text. /// A component which displays a colour along with related description text.
/// </summary> /// </summary>
public class ColourDisplay : CompositeDrawable, IHasCurrentValue<Color4> public class ColourDisplay : CompositeDrawable, IHasCurrentValue<Colour4>
{ {
private readonly BindableWithCurrent<Color4> current = new BindableWithCurrent<Color4>(); private readonly BindableWithCurrent<Colour4> current = new BindableWithCurrent<Colour4>();
private Box fill; private Box fill;
private OsuSpriteText colourHexCode; private OsuSpriteText colourHexCode;
private OsuSpriteText colourName; private OsuSpriteText colourName;
public Bindable<Color4> Current public Bindable<Colour4> Current
{ {
get => current.Current; get => current.Current;
set => current.Current = value; set => current.Current = value;

View File

@ -8,7 +8,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osuTK; using osuTK;
using osuTK.Graphics;
namespace osu.Game.Graphics.UserInterfaceV2 namespace osu.Game.Graphics.UserInterfaceV2
{ {
@ -17,7 +16,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
/// </summary> /// </summary>
public class ColourPalette : CompositeDrawable public class ColourPalette : CompositeDrawable
{ {
public BindableList<Color4> Colours { get; } = new BindableList<Color4>(); public BindableList<Colour4> Colours { get; } = new BindableList<Colour4>();
private string colourNamePrefix = "Colour"; private string colourNamePrefix = "Colour";

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osuTK.Graphics; using osu.Framework.Graphics;
namespace osu.Game.Graphics.UserInterfaceV2 namespace osu.Game.Graphics.UserInterfaceV2
{ {
@ -13,7 +13,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
{ {
} }
public BindableList<Color4> Colours => Component.Colours; public BindableList<Colour4> Colours => Component.Colours;
public string ColourNamePrefix public string ColourNamePrefix
{ {

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Localisation; using osu.Framework.Localisation;
@ -32,7 +33,7 @@ namespace osu.Game.Screens.Edit.Setup
var colours = Beatmap.BeatmapSkin?.GetConfig<GlobalSkinColours, IReadOnlyList<Color4>>(GlobalSkinColours.ComboColours)?.Value; var colours = Beatmap.BeatmapSkin?.GetConfig<GlobalSkinColours, IReadOnlyList<Color4>>(GlobalSkinColours.ComboColours)?.Value;
if (colours != null) if (colours != null)
comboColours.Colours.AddRange(colours); comboColours.Colours.AddRange(colours.Select(c => (Colour4)c));
} }
} }
} }