-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
61 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
namespace Reactor.Utilities.Extensions; | ||
|
||
/// <summary> | ||
/// Provides extension methods for TestMeshPro's Rich Text. | ||
/// </summary> | ||
internal static class RichTextExtensions | ||
{ | ||
private static string Wrap(this string text, string tag) | ||
{ | ||
return $"<{tag}>{text}</{tag}>"; | ||
} | ||
|
||
private static string Wrap(this string text, string tag, string value) | ||
{ | ||
return $"<{tag}={value}>{text}</{tag}>"; | ||
} | ||
|
||
public static string Align(this string text, string value) | ||
{ | ||
return text.Wrap("align", value); | ||
} | ||
|
||
public static string Color(this string text, string value) | ||
{ | ||
return text.Wrap("color", value); | ||
} | ||
|
||
public static string Size(this string text, string value) | ||
{ | ||
return text.Wrap("size", value); | ||
} | ||
|
||
public static string EscapeRichText(this string text) | ||
{ | ||
return text | ||
.Replace("<noparse>", string.Empty) | ||
.Replace("</noparse>", string.Empty) | ||
.Wrap("noparse"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters