Skip to content

Instantly share code, notes, and snippets.

@gaymeowing
Last active December 30, 2023 07:47
Show Gist options
  • Save gaymeowing/56be30041e6cdb3630426c4f46803456 to your computer and use it in GitHub Desktop.
Save gaymeowing/56be30041e6cdb3630426c4f46803456 to your computer and use it in GitHub Desktop.
--!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, "<", "&lt;")
String = string.gsub(String, ">", "&gt;")
String = string.gsub(String, "\"", "&quot;")
String = string.gsub(String, "'", "&apos;")
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