wolfhacklua API 1.1 Forum

theme

Restyle the overlay menu's accent colour, and read the colours the menu uses.

since 1.0no permission needed

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.

ParameterTypeDescription
optionstable{id, name, accent = {r, g, b}} with 0-255 channels.
lua
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.

ParameterTypeDescription
idstring | nilA theme id of this script, or nil for none.

theme.current#since 1.0

theme.current(): table

The colours the menu uses right now, so your drawing can match it.

ReturnsDescription
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.
lua
local t = theme.current()
draw.rect(20, 20, 100, 4, t.accent_rgba)
API 1.1 · source docs-src/api/theme.json