// Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; using osu.Game.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 { /// /// Tweens the accent colour of a drawable to another colour. /// /// The drawable to apply the accent colour to. /// The new accent colour. /// The tween duration. /// The tween easing. public static void FadeAccent(this T accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None) where T : Transformable, IHasAccentColour { accentedDrawable.TransformTo(() => accentedDrawable.AccentColour, newColour, duration, easing, new TransformAccent()); } } }