mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-01-10 19:02:08 +08:00
Update ColorUtilityUnstrip.cs
This commit is contained in:
parent
648ac941df
commit
32684bc63e
@ -10,14 +10,11 @@ namespace Explorer.Unstrip.ColorUtility
|
|||||||
{
|
{
|
||||||
public static string ToHex(this Color color)
|
public static string ToHex(this Color color)
|
||||||
{
|
{
|
||||||
var color32 = new Color32(
|
var r = (byte)Mathf.Clamp(Mathf.RoundToInt(color.r * 255f), 0, 255);
|
||||||
(byte)Mathf.Clamp(Mathf.RoundToInt(color.r * 255f), 0, 255),
|
var g = (byte)Mathf.Clamp(Mathf.RoundToInt(color.g * 255f), 0, 255);
|
||||||
(byte)Mathf.Clamp(Mathf.RoundToInt(color.g * 255f), 0, 255),
|
var b = (byte)Mathf.Clamp(Mathf.RoundToInt(color.b * 255f), 0, 255);
|
||||||
(byte)Mathf.Clamp(Mathf.RoundToInt(color.b * 255f), 0, 255),
|
|
||||||
1
|
|
||||||
);
|
|
||||||
|
|
||||||
return string.Format("{0:X2}{1:X2}{2:X2}", color32.r, color32.g, color32.b);
|
return $"{r:X2}{g:X2}{b:X2}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user