diff --git a/MLEM.Extended/Tiled/TiledExtensions.cs b/MLEM.Extended/Tiled/TiledExtensions.cs index ac285c0..867b115 100644 --- a/MLEM.Extended/Tiled/TiledExtensions.cs +++ b/MLEM.Extended/Tiled/TiledExtensions.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using MonoGame.Extended; using MonoGame.Extended.Tiled; +using ColorExtensions = MLEM.Extensions.ColorExtensions; namespace MLEM.Extended.Tiled { public static class TiledExtensions { @@ -23,7 +24,7 @@ namespace MLEM.Extended.Tiled { } public static Color GetColor(this TiledMapProperties properties, string key) { - return ColorHelper.FromHex(properties.Get(key)); + return ColorExtensions.FromHex(properties.Get(key)); } public static float GetFloat(this TiledMapProperties properties, string key) { diff --git a/MLEM/Extensions/ColorExtensions.cs b/MLEM/Extensions/ColorExtensions.cs index a41553e..dc08131 100644 --- a/MLEM/Extensions/ColorExtensions.cs +++ b/MLEM/Extensions/ColorExtensions.cs @@ -1,4 +1,5 @@ using System; +using System.Globalization; using Microsoft.Xna.Framework; namespace MLEM.Extensions { @@ -12,6 +13,12 @@ namespace MLEM.Extensions { return new Color((int) (value >> 16 & 0xFF), (int) (value >> 8 & 0xFF), (int) (value >> 0 & 0xFF), (int) (value >> 24 & 0xFF)); } + public static Color FromHex(string value) { + if (value.StartsWith("#")) + value = value.Substring(1); + return FromHex(uint.Parse(value, NumberStyles.HexNumber)); + } + public static Color CopyAlpha(this Color color, Color other) { return color * (other.A / 255F); }