mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 15:43:22 +08:00
Implement web colour schemes
This commit is contained in:
parent
428f3d1278
commit
02af546d3c
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using osu.Game.Beatmaps;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Graphics
|
||||
@ -63,6 +64,24 @@ namespace osu.Game.Graphics
|
||||
}
|
||||
}
|
||||
|
||||
public Color4 ForOverlayElement(OverlayColourScheme colourScheme, float saturation, float lightness, float opacity = 1) => Color4.FromHsl(new Vector4(getBaseHue(colourScheme), saturation, lightness, opacity));
|
||||
|
||||
private static float getBaseHue(OverlayColourScheme colourScheme)
|
||||
{
|
||||
var hue = colourScheme switch
|
||||
{
|
||||
OverlayColourScheme.Red => 0,
|
||||
OverlayColourScheme.Pink => 333,
|
||||
OverlayColourScheme.Orange => 46,
|
||||
OverlayColourScheme.Green => 115,
|
||||
OverlayColourScheme.Purple => 255,
|
||||
OverlayColourScheme.Blue => 200,
|
||||
_ => 0,
|
||||
};
|
||||
|
||||
return hue / 360f;
|
||||
}
|
||||
|
||||
// See https://github.com/ppy/osu-web/blob/master/resources/assets/less/colors.less
|
||||
public readonly Color4 PurpleLighter = FromHex(@"eeeeff");
|
||||
public readonly Color4 PurpleLight = FromHex(@"aa88ff");
|
||||
@ -165,4 +184,14 @@ namespace osu.Game.Graphics
|
||||
|
||||
public readonly Color4 ContextMenuGray = FromHex(@"223034");
|
||||
}
|
||||
|
||||
public enum OverlayColourScheme
|
||||
{
|
||||
Red,
|
||||
Pink,
|
||||
Orange,
|
||||
Green,
|
||||
Purple,
|
||||
Blue
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user