mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:52:53 +08:00
Add Color4.Opacity and OsuColor.Gray
This commit is contained in:
parent
70ecf48ca7
commit
c222be05c0
@ -6,6 +6,11 @@ namespace osu.Game.Graphics
|
||||
{
|
||||
public static class OsuColor
|
||||
{
|
||||
public static Color4 Opacity(this Color4 color, float a) => new Color4(color.R, color.G, color.B, a);
|
||||
public static Color4 Opacity(this Color4 color, byte a) => new Color4(color.R, color.G, color.B, a / 255f);
|
||||
public static Color4 Gray(float amt) => new Color4(amt, amt, amt, 1f);
|
||||
public static Color4 Gray(byte amt) => new Color4(amt, amt, amt, 255);
|
||||
|
||||
public static readonly Color4 OsuPink = new Color4(255, 102, 170, 255);
|
||||
|
||||
public static readonly Color4 BeatmapPanelUnselected = new Color4(20, 43, 51, 255);
|
||||
|
@ -151,7 +151,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Shear = new Vector2(shear, 0),
|
||||
Colour = new Color4(255, 255, 255, 128),
|
||||
Colour = Color4.White.Opacity(0.5f),
|
||||
};
|
||||
Add(flash);
|
||||
|
||||
|
@ -13,6 +13,7 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Online.Chat;
|
||||
@ -45,7 +46,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
Depth = float.MaxValue,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = new Color4(0.1f, 0.1f, 0.1f, 0.4f),
|
||||
Colour = OsuColor.Gray(0.1f).Opacity(0.4f),
|
||||
},
|
||||
content = new Container
|
||||
{
|
||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Overlays
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Colour = new Color4(0, 0, 0, 40),
|
||||
Colour = Color4.Black.Opacity(40),
|
||||
Radius = 5,
|
||||
};
|
||||
|
||||
@ -402,7 +402,7 @@ namespace osu.Game.Overlays
|
||||
Height = 50,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Colour = new Color4(0, 0, 0, 127)
|
||||
Colour = Color4.Black.Opacity(0.5f)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -111,8 +111,7 @@ namespace osu.Game.Overlays.Options
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Colour = new Color4(OsuColor.SliderbarNub.R,
|
||||
OsuColor.SliderbarNub.G, OsuColor.SliderbarNub.B, 0),
|
||||
Colour = OsuColor.SliderbarNub.Opacity(0),
|
||||
RelativeSizeAxes = Axes.Both
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
solidBackground = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = new Color4(0.1f, 0.1f, 0.1f, 1),
|
||||
Colour = OsuColor.Gray(0.1f),
|
||||
Alpha = alpha_normal,
|
||||
},
|
||||
gradientBackground = new Box
|
||||
@ -75,7 +75,8 @@ namespace osu.Game.Overlays.Toolbar
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Alpha = 0,
|
||||
Height = 90,
|
||||
ColourInfo = ColourInfo.GradientVertical(new Color4(0.1f, 0.1f, 0.1f, 0.5f), new Color4(0.1f, 0.1f, 0.1f, 0f)),
|
||||
ColourInfo = ColourInfo.GradientVertical(
|
||||
OsuColor.Gray(0.1f).Opacity(0.5f), OsuColor.Gray(0.1f).Opacity(0)),
|
||||
},
|
||||
new FlowContainer
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
HoverBackground = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = new Color4(80, 80, 80, 180),
|
||||
Colour = OsuColor.Gray(80).Opacity(180),
|
||||
BlendingMode = BlendingMode.Additive,
|
||||
Alpha = 0,
|
||||
},
|
||||
@ -144,7 +144,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
Action?.Invoke();
|
||||
sampleClick.Play();
|
||||
HoverBackground.FlashColour(new Color4(255, 255, 255, 100), 500, EasingTypes.OutQuint);
|
||||
HoverBackground.FlashColour(Color4.White.Opacity(100), 500, EasingTypes.OutQuint);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = new Color4(30, 30, 30, 255)
|
||||
Colour = OsuColor.Gray(30)
|
||||
},
|
||||
new Triangles
|
||||
{
|
||||
|
@ -17,6 +17,7 @@ using osu.Game.Configuration;
|
||||
using osu.Game.Online.API;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
@ -41,7 +42,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
Add(StateBackground = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = new Color4(150, 150, 150, 180),
|
||||
Colour = OsuColor.Gray(150).Opacity(180),
|
||||
BlendingMode = BlendingMode.Additive,
|
||||
Depth = 2,
|
||||
Alpha = 0,
|
||||
|
@ -16,6 +16,7 @@ using osu.Game.Configuration;
|
||||
using osu.Game.Online.API;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
@ -73,7 +74,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Radius = 4,
|
||||
Colour = new Color4(0, 0, 0, 0.1f),
|
||||
Colour = Color4.Black.Opacity(0.1f),
|
||||
};
|
||||
|
||||
Masking = true;
|
||||
|
@ -64,7 +64,7 @@ namespace osu.Game.Screens.Menu
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Colour = new Color4(0, 0, 0, 0.2f),
|
||||
Colour = Color4.Black.Opacity(0.2f),
|
||||
Roundness = 5,
|
||||
Radius = 8,
|
||||
},
|
||||
|
@ -72,7 +72,7 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(2, 1),
|
||||
Colour = new Color4(50, 50, 50, 255),
|
||||
Colour = OsuColor.Gray(50),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
|
@ -81,7 +81,7 @@ namespace osu.Game.Screens.Select
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ColourInfo = ColourInfo.GradientVertical(Color4.White, new Color4(1f, 1f, 1f, 0.3f)),
|
||||
ColourInfo = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)),
|
||||
Children = new []
|
||||
{
|
||||
// Zoomed-in and cropped beatmap background
|
||||
|
@ -63,7 +63,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(1, 0.5f),
|
||||
Colour = new Color4(0, 0, 0, 0.5f),
|
||||
Colour = Color4.Black.Opacity(0.5f),
|
||||
Shear = new Vector2(0.15f, 0),
|
||||
EdgeSmoothness = new Vector2(2, 0),
|
||||
},
|
||||
@ -73,7 +73,7 @@ namespace osu.Game.Screens.Select
|
||||
RelativePositionAxes = Axes.Y,
|
||||
Size = new Vector2(1, -0.5f),
|
||||
Position = new Vector2(0, 1),
|
||||
Colour = new Color4(0, 0, 0, 0.5f),
|
||||
Colour = Color4.Black.Opacity(0.5f),
|
||||
Shear = new Vector2(-0.15f, 0),
|
||||
EdgeSmoothness = new Vector2(2, 0),
|
||||
},
|
||||
@ -127,7 +127,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = Vector2.One,
|
||||
Colour = new Color4(0, 0, 0, 0.5f),
|
||||
Colour = Color4.Black.Opacity(0.5f),
|
||||
},
|
||||
new BackButton
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user