mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-24 18:00:26 +00:00
XCharts 2.0
This commit is contained in:
29
Runtime/Utils/ColorUtil.cs
Normal file
29
Runtime/Utils/ColorUtil.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
/************************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/************************************************/
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
public static class ColorUtil
|
||||
{
|
||||
public static readonly Color32 clearColor32 = new Color32(0, 0, 0, 0);
|
||||
public static readonly Vector2 zeroVector2 = Vector2.zero;
|
||||
/// <summary>
|
||||
/// Convert the html string to color.
|
||||
/// 将字符串颜色值转成Color。
|
||||
/// </summary>
|
||||
/// <param name="hexColorStr"></param>
|
||||
/// <returns></returns>
|
||||
public static Color32 GetColor(string hexColorStr)
|
||||
{
|
||||
Color color;
|
||||
ColorUtility.TryParseHtmlString(hexColorStr, out color);
|
||||
return (Color32)color;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user