diff --git a/CHANGELOG.md b/CHANGELOG.md index cb8d1f6..5fb651f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Improvements - Improved NinePatch memory performance - Moved sound-related classes into Sound namespace - Added customizable overloads for Keybind, Combination and GenericInput ToString methods +- Added ColorExtensions.Invert and made ColorHelper.Invert obsolete Fixes - Set default values for InputHandler held and pressed keys to avoid an exception if buttons are held in the very first frame diff --git a/MLEM/Extensions/ColorExtensions.cs b/MLEM/Extensions/ColorExtensions.cs index 201943c..31ba81c 100644 --- a/MLEM/Extensions/ColorExtensions.cs +++ b/MLEM/Extensions/ColorExtensions.cs @@ -18,6 +18,15 @@ namespace MLEM.Extensions { return color * (other.A / 255F); } + /// + /// Returns an inverted version of this color. + /// + /// The color to invert + /// The inverted color + public static Color Invert(this Color color) { + return new Color(Math.Abs(255 - color.R), Math.Abs(255 - color.G), Math.Abs(255 - color.B), color.A); + } + } /// @@ -25,13 +34,10 @@ namespace MLEM.Extensions { /// public static class ColorHelper { - /// - /// Returns an inverted version of the color. - /// - /// The color to invert - /// The inverted color + /// + [Obsolete("This method has been moved to ColorExtensions.Invert")] public static Color Invert(this Color color) { - return new Color(Math.Abs(255 - color.R), Math.Abs(255 - color.G), Math.Abs(255 - color.B), color.A); + return ColorExtensions.Invert(color); } ///