Skip to content

RichText

A simple service that makes using RichText easier by providing a set of methods to format strings instead of memorizing the RichText syntax. It does not provide formatting for all RichText features, but it does provide the most commonly used ones.


Summary

Constructors

color (text: string, color: Color3) : string
size (text: string, size: number) : string
font (text: string, font: Enum.Font) : string
bold (text: string) : string
italic (text: string) : string

Constructors

color

Formats a string to change its color.

RichText.color ( text: string, color: Color3 ) : string

Parameters

text : string
color : Color3

Returns

string
local RichText = Utility.RichText

local someGui: TextLabel = ...

local redHelloText: string = RichText.color("Hello", Color3.fromRGB(255, 0, 0))
local blueWorldText: string = RichText.color("world", Color3.fromRGB(0, 0, 255))

someGui.Text = redHelloText .. " " .. blueWorldText .. "!"

size

Formats a string to change its size.

RichText.size ( text: string, size: number ) : string

Parameters

text : string
size : number

Returns

string
local RichText = Utility.RichText

local someGui: TextLabel = ...

local bigHelloText: string = RichText.size("Hello", 24)
local smallWorldText: string = RichText.size("world", 12)

someGui.Text = bigHelloText .. " " .. smallWorldText .. "!"

font

Formats a string to change its font.

RichText.font ( text: string, font: Enum.Font ) : string

Parameters

text : string
font : Enum.Font

Returns

string
local RichText = Utility.RichText

local someGui: TextLabel = ...

local arialHelloText: string = RichText.font("Hello", Enum.Font.Arial)
local gothamWorldText: string = RichText.font("world", Enum.Font.Gotham)

someGui.Text = arialHelloText .. " " .. gothamWorldText .. "!"

bold

Formats a string to be bold.

RichText.bold ( text: string ) : string

Parameters

text : string

Returns

string
local RichText = Utility.RichText

local someGui: TextLabel = ...

local boldHelloWorldText: string = RichText.bold("Hello world!")

someGui.Text = boldHelloWorldText

italic

Formats a string to be italic.

RichText.italic ( text: string ) : string

Parameters

text : string

Returns

string
local RichText = Utility.RichText

local someGui: TextLabel = ...

local italicHelloWorldText: string = RichText.italic("Hello world!")

someGui.Text = italicHelloWorldText