2020-01-24 09:24:35 +00:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays
|
|
|
|
|
{
|
|
|
|
|
public class OverlayColourProvider
|
|
|
|
|
{
|
2024-07-17 21:05:44 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The hue degree associated with the colour shades provided by this <see cref="OverlayColourProvider"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int Hue { get; private set; }
|
2020-01-24 09:24:35 +00:00
|
|
|
|
|
|
|
|
|
public OverlayColourProvider(OverlayColourScheme colourScheme)
|
2024-07-17 21:05:44 +00:00
|
|
|
|
: this(colourScheme.GetHue())
|
2020-01-24 09:24:35 +00:00
|
|
|
|
{
|
2024-07-17 21:05:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public OverlayColourProvider(int hue)
|
|
|
|
|
{
|
|
|
|
|
Hue = hue;
|
2020-01-24 09:24:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-02-20 19:40:08 +00:00
|
|
|
|
// Note that the following five colours are also defined in `OsuColour` as `{colourScheme}{0,1,2,3,4}`.
|
|
|
|
|
// The difference as to which should be used where comes down to context.
|
|
|
|
|
// If the colour in question is supposed to always match the view in which it is displayed theme-wise, use `OverlayColourProvider`.
|
|
|
|
|
// If the colour usage is special and in general differs from the surrounding view in choice of hue, use the `OsuColour` constants.
|
2022-02-20 19:40:39 +00:00
|
|
|
|
public Color4 Colour0 => getColour(1, 0.8f);
|
2021-01-13 14:06:44 +00:00
|
|
|
|
public Color4 Colour1 => getColour(1, 0.7f);
|
|
|
|
|
public Color4 Colour2 => getColour(0.8f, 0.6f);
|
|
|
|
|
public Color4 Colour3 => getColour(0.6f, 0.5f);
|
|
|
|
|
public Color4 Colour4 => getColour(0.4f, 0.3f);
|
|
|
|
|
|
2020-01-26 09:42:23 +00:00
|
|
|
|
public Color4 Highlight1 => getColour(1, 0.7f);
|
|
|
|
|
public Color4 Content1 => getColour(0.4f, 1);
|
|
|
|
|
public Color4 Content2 => getColour(0.4f, 0.9f);
|
|
|
|
|
public Color4 Light1 => getColour(0.4f, 0.8f);
|
|
|
|
|
public Color4 Light2 => getColour(0.4f, 0.75f);
|
|
|
|
|
public Color4 Light3 => getColour(0.4f, 0.7f);
|
|
|
|
|
public Color4 Light4 => getColour(0.4f, 0.5f);
|
|
|
|
|
public Color4 Dark1 => getColour(0.2f, 0.35f);
|
|
|
|
|
public Color4 Dark2 => getColour(0.2f, 0.3f);
|
|
|
|
|
public Color4 Dark3 => getColour(0.2f, 0.25f);
|
|
|
|
|
public Color4 Dark4 => getColour(0.2f, 0.2f);
|
|
|
|
|
public Color4 Dark5 => getColour(0.2f, 0.15f);
|
|
|
|
|
public Color4 Dark6 => getColour(0.2f, 0.1f);
|
|
|
|
|
public Color4 Foreground1 => getColour(0.1f, 0.6f);
|
|
|
|
|
public Color4 Background1 => getColour(0.1f, 0.4f);
|
|
|
|
|
public Color4 Background2 => getColour(0.1f, 0.3f);
|
|
|
|
|
public Color4 Background3 => getColour(0.1f, 0.25f);
|
|
|
|
|
public Color4 Background4 => getColour(0.1f, 0.2f);
|
|
|
|
|
public Color4 Background5 => getColour(0.1f, 0.15f);
|
|
|
|
|
public Color4 Background6 => getColour(0.1f, 0.1f);
|
2020-01-26 09:39:15 +00:00
|
|
|
|
|
2024-06-29 06:59:40 +00:00
|
|
|
|
/// <summary>
|
2024-07-17 21:05:44 +00:00
|
|
|
|
/// Changes the <see cref="Hue"/> to a different degree.
|
2024-06-29 06:59:40 +00:00
|
|
|
|
/// Note that this does not trigger any kind of signal to any drawable that received colours from here, all drawables need to be updated manually.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="colourScheme">The proposed colour scheme.</param>
|
2024-07-17 21:05:44 +00:00
|
|
|
|
public void ChangeColourScheme(OverlayColourScheme colourScheme) => ChangeColourScheme(colourScheme.GetHue());
|
2024-06-29 06:59:40 +00:00
|
|
|
|
|
2024-07-17 21:05:44 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Changes the <see cref="Hue"/> to a different degree.
|
|
|
|
|
/// Note that this does not trigger any kind of signal to any drawable that received colours from here, all drawables need to be updated manually.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="hue">The proposed hue degree.</param>
|
|
|
|
|
public void ChangeColourScheme(int hue) => Hue = hue;
|
2020-01-24 09:24:35 +00:00
|
|
|
|
|
2024-07-17 21:05:44 +00:00
|
|
|
|
private Color4 getColour(float saturation, float lightness) => Framework.Graphics.Colour4.FromHSL(Hue / 360f, saturation, lightness);
|
2020-01-24 09:24:35 +00:00
|
|
|
|
}
|
|
|
|
|
}
|