Themes
The nine built-in palettes and the fourteen colour roles behind them.
Switching theme#
One call. Everything already on screen repaints, including notifications:
Ember.SetTheme("Midnight")Let the user choose:
settings:Dropdown({
Text = "Theme",
Options = Ember.ThemeNames(),
Default = "Dark",
Save = "theme",
Callback = function(name) Ember.SetTheme(name) end,
})The nine built in#
Set the one your script opens with before creating a window:
Ember.Configure({ Themes = { Default = "Nord" } })Default applies when no theme has been set. A later SetTheme wins over it,
so a script can put back whatever its user picked last session:
Ember.Configure({ Themes = { Default = "Nord" } })
local saved = Ember.Store.get("prefs")
if saved and saved.theme then
Ember.SetTheme(saved.theme) -- this sticks; the window will not undo it
end
local win = Ember.new({ Title = "My Script" })Ember.new({ Theme = "Ocean" }) runs when the window is built, so it wins over
both.
Restricting the list#
To publish a script with a fixed look, limit what ThemeNames() returns:
-- Only these, in this order
Ember.Configure({ Themes = { Only = { "Dark", "Midnight", "Ember" } } })
-- Everything except these
Ember.Configure({ Themes = { Hide = { "Mono", "Rose" } } })Set both and both apply: Only picks the list, then Hide is subtracted from
it. Only = { "Dark", "Ember" } with Hide = { "Ember" } leaves Dark.
The fourteen roles#
A theme is fourteen Color3 values and nothing else.
| Role | What it paints | Where you see it |
|---|---|---|
bg | Window background | Behind everything, and inside inputs. |
panel | Sidebar | The section rail on the left. |
panel2 | Card surface | Every control's card. |
panel3 | Hover surface | A card or row under the cursor. |
border | Hairline border | The 1px outline on cards and controls. |
border2 | Strong border | Dividers and the resize grip. |
text | Body text | Titles and values. |
muted | Secondary text | Labels and inactive tabs. |
faint | Placeholder text | Descriptions and placeholders. |
accent | Accent | Buttons, toggles, the active tab pip. |
accentInk | Text on accent | Text ON a filled accent button. Keep it dark. |
danger | Danger / delete | Delete buttons and warnings. |
hover | Control hover fill | Fill behind a hovered control. |
scrollIdle | Scrollbar at rest | The scrollbar before you touch it. |
The four you will change most often:
accentis the brand colour. Every filled control uses it.bgsits behind everything, and inside input fields.panel2is every control's card.textis titles and values.mutedis labels,faintis placeholders.
accentInk has to stay dark
accentInk is the text on a filled accent button. If you set the accent to a
pale colour and leave accentInk light, filled buttons become unreadable.
Reading the current theme#
Ember.Theme.accent --> Color3
Ember.Theme.panel2 --> Color3
Ember.CurrentTheme --> the name last applied; nil until a named SetTheme
Ember.ThemeNames() --> { "Dark", "Midnight", … } what the user may pick
Ember.Themes --> every palette by name, including registered ones
Ember.ThemeRoles --> { "bg", "panel", … } every role name
Ember.ThemeRoleLabels --> { panel2 = "Card surface", … } all of them at once
Ember.ThemeRoleLabel("panel2") --> "Card surface"
Ember.IsBuiltInTheme("Dark") --> trueThemeNames honours Only and Hide; Themes does not, so read it when you
want the whole set.
Ember.Theme is live: after SetTheme, reading it gives the new colours. Use
it to paint your own GUI elements so they match:
myLabel.TextColor3 = Ember.Theme.text
myFrame.BackgroundColor3 = Ember.Theme.panel2To keep them matching when the theme changes:
Ember.OnThemeApplied(function()
myLabel.TextColor3 = Ember.Theme.text
myFrame.BackgroundColor3 = Ember.Theme.panel2
end)It fires when a theme is applied by name. A single-role apply such as
Ember.SetTheme({ accent = colour }) changes Ember.Theme without calling it.
Making your own#
See Custom themes for registering your own palettes and for the built-in editor.