// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osuTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; namespace osu.Game.Graphics { /// /// A type of drawable that has an accent colour. /// The accent colour is used to colorize various objects inside a drawable /// without colorizing the drawable itself. /// public interface IHasAccentColour : IDrawable { Color4 AccentColour { get; set; } } public static class AccentedColourExtensions { /// /// Smoothly adjusts over time. /// /// A to which further transforms can be added. public static TransformSequence FadeAccent(this T accentedDrawable, Color4 newColour, double duration = 0, Easing easing = Easing.None) where T : IHasAccentColour => accentedDrawable.TransformTo(nameof(accentedDrawable.AccentColour), newColour, duration, easing); /// /// Smoothly adjusts over time. /// /// A to which further transforms can be added. public static TransformSequence FadeAccent(this TransformSequence t, Color4 newColour, double duration = 0, Easing easing = Easing.None) where T : Drawable, IHasAccentColour => t.Append(o => o.FadeAccent(newColour, duration, easing)); } }