theme
Restyle the overlay menu's accent colour, and read the colours the menu uses.
Always available. A registered theme appears in the script's tab on the Scripts page; while it is chosen the menu's accent follows it, and the menu's own colours are restored the moment the theme is deselected or the script stops.
Reference#
theme.register#since 1.0
theme.register(options: table)Adds a theme the user can pick.
| Parameter | Type | Description |
|---|---|---|
options | table | {id, name, accent = {r, g, b}} with 0-255 channels. |
theme.register{ id = "ember", name = "Ember", accent = { 255, 122, 24 } }theme.activate#since 1.0
theme.activate(id: string | nil)Chooses a theme from code.
| Parameter | Type | Description |
|---|---|---|
id | string | nil | A theme id of this script, or nil for none. |
theme.current#since 1.0
theme.current(): tableThe colours the menu uses right now, so your drawing can match it.
| Returns | Description |
|---|---|
table | {accent = {r, g, b}, accent_rgba, background, card, border, text, text_dim, danger, success, active}; the colours are 0xRRGGBBAA integers and active is the chosen theme's id. |
local t = theme.current()
draw.rect(20, 20, 100, 4, t.accent_rgba)