// 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.Graphics; using osuTK.Graphics; namespace osu.Game.Skinning { /// /// Compatibility methods to apply osu!stable quirks to colours. Should be used for legacy skins only. /// public static class LegacyColourCompatibility { /// /// Forces an alpha of 1 if a given is fully transparent. /// /// /// This is equivalent to setting colour post-constructor in osu!stable. /// /// The to disallow zero alpha on. /// The resultant . public static Color4 DisallowZeroAlpha(Color4 colour) { if (colour.A == 0) colour.A = 1; return colour; } /// /// Applies a to a , doubling the alpha value into the property. /// /// /// This is equivalent to setting colour in the constructor in osu!stable. /// /// The to apply the colour to. /// The to apply. /// The given . public static T ApplyWithDoubledAlpha(T drawable, Color4 colour) where T : Drawable { drawable.Alpha = colour.A; drawable.Colour = DisallowZeroAlpha(colour); return drawable; } } }