diff --git a/src/Unstrip/ColorUtility/ColorUtilityUnstrip.cs b/src/Unstrip/ColorUtility/ColorUtilityUnstrip.cs index 8611c9a..8e950b5 100644 --- a/src/Unstrip/ColorUtility/ColorUtilityUnstrip.cs +++ b/src/Unstrip/ColorUtility/ColorUtilityUnstrip.cs @@ -10,14 +10,11 @@ namespace Explorer.Unstrip.ColorUtility { public static string ToHex(this Color color) { - var color32 = new Color32( - (byte)Mathf.Clamp(Mathf.RoundToInt(color.r * 255f), 0, 255), - (byte)Mathf.Clamp(Mathf.RoundToInt(color.g * 255f), 0, 255), - (byte)Mathf.Clamp(Mathf.RoundToInt(color.b * 255f), 0, 255), - 1 - ); + var r = (byte)Mathf.Clamp(Mathf.RoundToInt(color.r * 255f), 0, 255); + var g = (byte)Mathf.Clamp(Mathf.RoundToInt(color.g * 255f), 0, 255); + var b = (byte)Mathf.Clamp(Mathf.RoundToInt(color.b * 255f), 0, 255); - return string.Format("{0:X2}{1:X2}{2:X2}", color32.r, color32.g, color32.b); + return $"{r:X2}{g:X2}{b:X2}"; } } }