Skip to content

Commit

Permalink
make the color parser public
Browse files Browse the repository at this point in the history
For uniformity in dependent mods that use this material def system.
  • Loading branch information
al2me6 committed Jul 27, 2024
1 parent ac9e9f3 commit 05fb97d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Source/MaterialDef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,15 @@ Dictionary<string, T> LoadDictionary<T>(ConfigNode node, Func<string, object> pa
return items;
}

static object ParseColor(string value)
public static bool ParseColor(string value, out Color color)
{
if (ColorUtility.TryParseHtmlString(value, out var color)) return color;
if (ParseExtensions.TryParseColor(value, out color)) return color;
return null;
if (ColorUtility.TryParseHtmlString(value, out color)) return true;
if (ParseExtensions.TryParseColor(value, out color)) return true;
return false;
}

static object ParseColor(string value) => ParseColor(value, out var color) ? (object)color : null;

/// <summary>
/// Create a new material based on this definition. The material name is copied from the
/// passed reference material. In update-existing mode, all properties are also copied from
Expand Down

0 comments on commit 05fb97d

Please sign in to comment.