forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RichTextLabelExt.cs
31 lines (26 loc) · 914 Bytes
/
RichTextLabelExt.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Utility;
namespace Content.Client.Message;
public static class RichTextLabelExt
{
/// <summary>
/// Sets the labels markup.
/// </summary>
/// <remarks>
/// Invalid markup will cause exceptions to be thrown. Don't use this for user input!
/// </remarks>
public static RichTextLabel SetMarkup(this RichTextLabel label, string markup)
{
label.SetMessage(FormattedMessage.FromMarkupOrThrow(markup));
return label;
}
/// <summary>
/// Sets the labels markup.<br/>
/// Uses <c>FormatedMessage.FromMarkupPermissive</c> which treats invalid markup as text.
/// </summary>
public static RichTextLabel SetMarkupPermissive(this RichTextLabel label, string markup)
{
label.SetMessage(FormattedMessage.FromMarkupPermissive(markup));
return label;
}
}