39 lines
1.6 KiB
C#
39 lines
1.6 KiB
C#
using System;
|
|
using System.Runtime.CompilerServices;
|
|
using UnityEngine.Scripting;
|
|
|
|
namespace UnityEngine
|
|
{
|
|
// Token: 0x0200002A RID: 42
|
|
public sealed class ColorUtility
|
|
{
|
|
// Token: 0x0600035F RID: 863
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
internal static extern bool DoTryParseHtmlColor(string htmlString, out Color32 color);
|
|
|
|
// Token: 0x06000360 RID: 864 RVA: 0x00006068 File Offset: 0x00004268
|
|
public static bool TryParseHtmlString(string htmlString, out Color color)
|
|
{
|
|
Color32 color2;
|
|
bool flag = ColorUtility.DoTryParseHtmlColor(htmlString, out color2);
|
|
color = color2;
|
|
return flag;
|
|
}
|
|
|
|
// Token: 0x06000361 RID: 865 RVA: 0x00006094 File Offset: 0x00004294
|
|
public static string ToHtmlStringRGB(Color color)
|
|
{
|
|
Color32 color2 = 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);
|
|
return string.Format("{0:X2}{1:X2}{2:X2}", color2.r, color2.g, color2.b);
|
|
}
|
|
|
|
// Token: 0x06000362 RID: 866 RVA: 0x0000613C File Offset: 0x0000433C
|
|
public static string ToHtmlStringRGBA(Color color)
|
|
{
|
|
Color32 color2 = 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), (byte)Mathf.Clamp(Mathf.RoundToInt(color.a * 255f), 0, 255));
|
|
return string.Format("{0:X2}{1:X2}{2:X2}{3:X2}", new object[] { color2.r, color2.g, color2.b, color2.a });
|
|
}
|
|
}
|
|
}
|