Theme Service
ThemeService
is a service that provides a way to manage and apply themes to UI elements,like colors, fonts, and styles.
Theme Service Service Singleton
Functions
Theme.load()
Function
Theme.load(ThemeFile)
- Loads a theme file to apply to UI elements.
Parameters:
- ThemeFile string— path to the theme file
- ThemeFile Schema:
ThemeFile.lua
WCSS{ -- WCSS is a global of Weo that controls the theme system.
Frame = {
primary = {
bgcolor = rgb(0,255,0),
},
dark = {
bgcolor = rgb(25,25,25),
},
},
Label = {
dark = {
textcolor = rgb(255,255,255),
fontsize = 25,
}
}
}
Global Variables
Styles Table
- Holds all the styles defined in the theme file.
rgba Function
rgba(r, g, b, a)
- Converts a color value to RGBA format.
rgb Function
rgb(r, g, b)
- Converts a color value to RGB format.
Setting Styles
- You can set the variable of the element to
table<styleName,...>
.
Example
Theme.load("ThemeFile.lua")
local Frame = Frame.new(Render, {
position = UDim2.new(0, 0, 0, 0),
size = UDim2.new(0, 100, 0, 100),
bgcolor = Color.fromHEX("#000000FF"),
visible = true,
borderRadius = 15,
zIndex = 0,
cursor = Enum.CursorStyle.Cross,
class = {
"primary","dark" -- Supports multiple styles.
}
}) -- This will overwrite the default style with the `dark` and `primary` styles.
Note
- Tweening to WCSS is not supported yet.