diff --git a/osu.Game/Graphics/OsuColor.cs b/osu.Game/Graphics/OsuColor.cs index e516b38983..af62e29f27 100644 --- a/osu.Game/Graphics/OsuColor.cs +++ b/osu.Game/Graphics/OsuColor.cs @@ -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); diff --git a/osu.Game/Graphics/UserInterface/BackButton.cs b/osu.Game/Graphics/UserInterface/BackButton.cs index 3203240581..faa47eae2b 100644 --- a/osu.Game/Graphics/UserInterface/BackButton.cs +++ b/osu.Game/Graphics/UserInterface/BackButton.cs @@ -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); diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 22f7a3a78f..a3ae3ca876 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -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 { diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 0ef986a4e6..932306d033 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -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) } }; } diff --git a/osu.Game/Overlays/Options/SliderOption.cs b/osu.Game/Overlays/Options/SliderOption.cs index ff0e8318d8..2571db8ec2 100644 --- a/osu.Game/Overlays/Options/SliderOption.cs +++ b/osu.Game/Overlays/Options/SliderOption.cs @@ -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 } } diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index df6168b6c5..3ff127e964 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -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 { diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index 80b2fcdb42..1d8999d2a4 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -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 { diff --git a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs index b72a358456..c4bec26767 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs @@ -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, diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs index 09708fc403..e093dbeca0 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs @@ -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; diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 28158457dd..719d75b018 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -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, }, diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 6e15d458c1..c2b9513d56 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -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, }, diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index eb176f4bdd..e451aa9991 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -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 diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index b14e959755..f2df737d7f 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -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 {