Class Theme
java.lang.Object
dev.myriadclient.api.ui.Theme
- All Implemented Interfaces:
Identified
A theme preset: applying it writes values into the live
ThemeSettings (anything it doesn't set keeps
Myriad's default). Players can edit a preset; their edits are saved on top of it. Register one with
AddonContext.registerTheme; it shows in the Theme window, and Ui.applyTheme(MyriadId) applies it.
ctx.registerTheme(new Theme(ctx.id("sunset"), "Sunset", t -> ThemePalette.of(...).apply(t)));
Optional extras for themes that come from outside the game, like a system theme:
live (re-apply when it changes), notice (explain a problem in the Theme panel),
aliases (old ids it replaces) and preferOnFirstRun.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaliases()The idsaliases(String...)set; empty by default.Ids this theme replaces (from an older version or another addon), asnamespace:pathstrings; saved choices and edits carry over.apply()What writes the preset's values into the theme.id()The id,<mod id of the addon that registered it>:<path>; it doesn't change once registered.live()Whatlive(Supplier)set, or null for a theme that doesn't follow anything.Makes the theme follow something that changes outside the game.name()The name players see.@Nullable Stringnotice()The messagenotice(Supplier)gives now, or null when there's none (or no notice was set).A message the Theme panel shows (highlighted) whilenoticereturns non-null, e.g.Use this theme instead of Myriad's default on a fresh install (e.g.booleanWhetherpreferOnFirstRun()was called.toString()Its name.
-
Constructor Details
-
Theme
- Parameters:
id- its registry id, also what saved choices refer toname- the name players seeapply- writes the preset's values into the theme; it runs after every theme value was reset to Myriad's default, and before the player's own edits are put back on top
-
-
Method Details
-
id
Description copied from interface:IdentifiedThe id,<mod id of the addon that registered it>:<path>; it doesn't change once registered.- Specified by:
idin interfaceIdentified
-
name
The name players see. -
apply
What writes the preset's values into the theme. -
live
Makes the theme follow something that changes outside the game. While it's active, Myriad callsversionevery couple of seconds and re-applies the theme when the returned string changes (return e.g. a file's modification time). A call that throws counts as an empty string. Returns this theme. -
notice
-
aliases
-
preferOnFirstRun
Use this theme instead of Myriad's default on a fresh install (e.g. one that matches the player's system). If several themes ask, the first in the theme registry wins. Returns this theme. -
live
Whatlive(Supplier)set, or null for a theme that doesn't follow anything. -
notice
The messagenotice(Supplier)gives now, or null when there's none (or no notice was set). -
aliases
The idsaliases(String...)set; empty by default. -
prefersFirstRun
public boolean prefersFirstRun()WhetherpreferOnFirstRun()was called. -
toString
-