Last active
December 30, 2023 07:47
-
-
Save gaymeowing/56be30041e6cdb3630426c4f46803456 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
--!strict | |
-- RichTextUtil | |
-- simple utility module for rich text | |
-- @Kalrnlo | |
-- 02/12/2023 | |
local RichTextUtil = {} | |
-- Taken from | |
-- https://devforum.roblox.com/t/1640202/4 | |
function RichTextUtil.RemoveRichTextTags(String: string) | |
local String = string.gsub(String, "&", "&") -- (must do & first) | |
String = string.gsub(String, "<", "<") | |
String = string.gsub(String, ">", ">") | |
String = string.gsub(String, "\"", """) | |
String = string.gsub(String, "'", "'") | |
return String | |
end | |
function RichTextUtil.GetRichTextTagFromHex(Color: string | Color3) | |
local Color = if typeof(Color) == "Color3" then Color:ToHex() else Color | |
return `<font color="#{Color}">` | |
end | |
return RichTextUtil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment