diff --git a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs index 8134c10750..3d63e2b07e 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneCommentsContainer.cs @@ -8,6 +8,8 @@ using osu.Game.Online.API.Requests; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Game.Overlays.Comments; +using osu.Game.Overlays; +using osu.Framework.Allocation; namespace osu.Game.Tests.Visual.Online { @@ -28,6 +30,9 @@ namespace osu.Game.Tests.Visual.Online protected override bool UseOnlineAPI => true; + [Cached] + private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple); + public TestSceneCommentsContainer() { BasicScrollContainer scroll; diff --git a/osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs index bc3e0eff1a..a60f220e4b 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs @@ -4,7 +4,9 @@ using System; using System.Collections.Generic; using NUnit.Framework; +using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Game.Overlays; using osu.Game.Overlays.Comments; namespace osu.Game.Tests.Visual.Online @@ -19,6 +21,9 @@ namespace osu.Game.Tests.Visual.Online typeof(SortTabControl), }; + [Cached] + private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue); + private readonly Bindable sort = new Bindable(); private readonly BindableBool showDeleted = new BindableBool(); diff --git a/osu.Game.Tests/Visual/Online/TestSceneTotalCommentsCounter.cs b/osu.Game.Tests/Visual/Online/TestSceneTotalCommentsCounter.cs index f14c75084f..8ecbf0891b 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneTotalCommentsCounter.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneTotalCommentsCounter.cs @@ -7,6 +7,8 @@ using osu.Framework.Graphics; using osu.Framework.Bindables; using osu.Game.Overlays.Comments; using osu.Framework.Utils; +using osu.Framework.Allocation; +using osu.Game.Overlays; namespace osu.Game.Tests.Visual.Online { @@ -17,6 +19,9 @@ namespace osu.Game.Tests.Visual.Online typeof(TotalCommentsCounter), }; + [Cached] + private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue); + public TestSceneTotalCommentsCounter() { var count = new BindableInt(); diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs index d252083411..78df73eb0d 100644 --- a/osu.Game/Overlays/Comments/CommentsContainer.cs +++ b/osu.Game/Overlays/Comments/CommentsContainer.cs @@ -8,7 +8,6 @@ using osu.Game.Online.API.Requests; using osu.Framework.Graphics; using osu.Framework.Bindables; using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics; using osu.Game.Online.API.Requests.Responses; using System.Threading; using System.Linq; @@ -27,28 +26,26 @@ namespace osu.Game.Overlays.Comments [Resolved] private IAPIProvider api { get; set; } - [Resolved] - private OsuColour colours { get; set; } - private GetCommentsRequest request; private CancellationTokenSource loadCancellation; private int currentPage; - private readonly Box background; - private readonly FillFlowContainer content; - private readonly DeletedChildrenPlaceholder deletedChildrenPlaceholder; - private readonly CommentsShowMoreButton moreButton; - private readonly TotalCommentsCounter commentCounter; + private FillFlowContainer content; + private DeletedChildrenPlaceholder deletedChildrenPlaceholder; + private CommentsShowMoreButton moreButton; + private TotalCommentsCounter commentCounter; - public CommentsContainer() + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; AddRangeInternal(new Drawable[] { - background = new Box + new Box { RelativeSizeAxes = Axes.Both, + Colour = colourProvider.Background5 }, new FillFlowContainer { @@ -78,7 +75,7 @@ namespace osu.Game.Overlays.Comments new Box { RelativeSizeAxes = Axes.Both, - Colour = OsuColour.Gray(0.2f) + Colour = colourProvider.Background4 }, new FillFlowContainer { @@ -113,12 +110,6 @@ namespace osu.Game.Overlays.Comments }); } - [BackgroundDependencyLoader] - private void load() - { - background.Colour = colours.Gray2; - } - protected override void LoadComplete() { Sort.BindValueChanged(_ => refetchComments(), true); diff --git a/osu.Game/Overlays/Comments/CommentsHeader.cs b/osu.Game/Overlays/Comments/CommentsHeader.cs index 6a7a678cc7..ad80e67330 100644 --- a/osu.Game/Overlays/Comments/CommentsHeader.cs +++ b/osu.Game/Overlays/Comments/CommentsHeader.cs @@ -76,9 +76,9 @@ namespace osu.Game.Overlays.Comments } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OverlayColourProvider colourProvider) { - background.Colour = colours.Gray3; + background.Colour = colourProvider.Background4; } private class ShowDeletedButton : HeaderButton diff --git a/osu.Game/Overlays/Comments/CommentsShowMoreButton.cs b/osu.Game/Overlays/Comments/CommentsShowMoreButton.cs index b0174e7b1a..ab65c9c63a 100644 --- a/osu.Game/Overlays/Comments/CommentsShowMoreButton.cs +++ b/osu.Game/Overlays/Comments/CommentsShowMoreButton.cs @@ -1,8 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; using osu.Framework.Bindables; -using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Comments @@ -11,11 +11,12 @@ namespace osu.Game.Overlays.Comments { public readonly BindableInt Current = new BindableInt(); - public CommentsShowMoreButton() + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) { - IdleColour = OsuColour.Gray(0.3f); - HoverColour = OsuColour.Gray(0.4f); - ChevronIconColour = OsuColour.Gray(0.5f); + IdleColour = colourProvider.Background2; + HoverColour = colourProvider.Background1; + ChevronIconColour = colourProvider.Foreground1; } protected override void LoadComplete() diff --git a/osu.Game/Overlays/Comments/HeaderButton.cs b/osu.Game/Overlays/Comments/HeaderButton.cs index 8789cf5830..fdc8db35ab 100644 --- a/osu.Game/Overlays/Comments/HeaderButton.cs +++ b/osu.Game/Overlays/Comments/HeaderButton.cs @@ -5,7 +5,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics; using osu.Framework.Input.Events; using osu.Game.Graphics.UserInterface; @@ -45,9 +44,9 @@ namespace osu.Game.Overlays.Comments } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OverlayColourProvider colourProvider) { - background.Colour = colours.Gray4; + background.Colour = colourProvider.Background3; } protected override bool OnHover(HoverEvent e) diff --git a/osu.Game/Overlays/Comments/SortTabControl.cs b/osu.Game/Overlays/Comments/SortTabControl.cs index a114197b8d..700d63351f 100644 --- a/osu.Game/Overlays/Comments/SortTabControl.cs +++ b/osu.Game/Overlays/Comments/SortTabControl.cs @@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Comments public readonly BindableBool Active = new BindableBool(); [Resolved] - private OsuColour colours { get; set; } + private OverlayColourProvider colourProvider { get; set; } private readonly SpriteText text; @@ -78,7 +78,7 @@ namespace osu.Game.Overlays.Comments updateBackgroundState(); text.Font = text.Font.With(weight: active.NewValue ? FontWeight.Bold : FontWeight.Medium); - text.Colour = active.NewValue ? colours.BlueLighter : Color4.White; + text.Colour = active.NewValue ? colourProvider.Light1 : Color4.White; }, true); } diff --git a/osu.Game/Overlays/Comments/TotalCommentsCounter.cs b/osu.Game/Overlays/Comments/TotalCommentsCounter.cs index 376853c1de..1bb9b52689 100644 --- a/osu.Game/Overlays/Comments/TotalCommentsCounter.cs +++ b/osu.Game/Overlays/Comments/TotalCommentsCounter.cs @@ -5,7 +5,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; -using osu.Framework.Graphics.Sprites; using osuTK; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -17,9 +16,10 @@ namespace osu.Game.Overlays.Comments { public readonly BindableInt Current = new BindableInt(); - private readonly SpriteText counter; + private OsuSpriteText counter; - public TotalCommentsCounter() + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) { RelativeSizeAxes = Axes.X; Height = 50; @@ -38,6 +38,7 @@ namespace osu.Game.Overlays.Comments Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Font = OsuFont.GetFont(size: 20, italics: true), + Colour = colourProvider.Light1, Text = @"Comments" }, new CircularContainer @@ -51,14 +52,15 @@ namespace osu.Game.Overlays.Comments new Box { RelativeSizeAxes = Axes.Both, - Colour = OsuColour.Gray(0.05f) + Colour = colourProvider.Background6 }, counter = new OsuSpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Margin = new MarginPadding { Horizontal = 10, Vertical = 5 }, - Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold) + Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold), + Colour = colourProvider.Foreground1 } }, } @@ -66,12 +68,6 @@ namespace osu.Game.Overlays.Comments }); } - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - counter.Colour = colours.BlueLighter; - } - protected override void LoadComplete() { Current.BindValueChanged(value => counter.Text = value.NewValue.ToString("N0"), true);