RSML (Roblox Style Management Language) is a text based language for defining Roblox StyleSheets.
Example
Advantages
RSML is text based which means it can be used in workflows involving version control tools such as git.
The language also builds on the foundations made by StyleSheets and includes extra features which StyleSheets don’t natively have, such as: Macros
, Static Tokens
, and OkLab
and Oklch
Color Spaces.
Macros (docs)
Macros allow you to insert pre-defined snippets into your code which can help speed up development. For example, the macro below makes it easier to apply a corner radius to a UI element:
RSML has some macros built-in to further aid in speeding up development: Padding
, CornerRadius
(seen in the example above), and Scale
. An up to date list can be found here.
Static Tokens (docs)
Static Tokens
are like Tokens
except they are resolved during compilation. This means their value can’t be changed dynamically during runtime, but unlike regular tokens mathematical operations can be performed on them and intermediate data types can be assigned to them.
They are written with a $!
prefix as follows:
OkLab & OkLch Color Spaces (docs)
OkLab and OkLch are color spaces which provide more accurate and perceptually uniform color representation, making them better for accessibility and creating visually appealing designs.
They are currently implemented as intermediate data types as Roblox doesn’t natively support them. This means that they will turn into Color3
’s when assigned to Properties
or Tokens
.
Integrations
There are various ways to use RSML in your workflows. The recommended ways are below, however a full list can be viewed here.
RSML CLI
The best way to use RSML is via the CLI (command line interface). The CLI transforms .rsml
files into .model.json
files (a format that rojo can read), Installation instructions can be found here.
RSML Luau
You can parse RSML directly in Luau (and Typescript) via the integration found here.
At the time of this post the Luau version doesn’t support Macros
, Skin Color Codes
, Static Tokens
, Some Data Type Modifier
s, and OkLch
and OKlab
Color Spaces.
Syntax Highlighting
The RSML Visual Studio Code Plugin can be used to enable syntax highlighting in .rsml
, .luau
and .ts
files. It can be found here.