ThemeControl beta
Class of @v12-engine/client
export declare class ThemeControlThe look of the interface while a game (or the editor) is on: the theme it started with, and what code changed since. It writes onto an element, the game's own (its tooltips, menus and dialogs are in it too), or the whole page when given none (document.documentElement), and takes it all off again when the game ends (dispose)
Members
constructor
constructor(
initial: ThemeSpec | undefined, element?: HTMLElement | undefined);Constructs a new instance of the ThemeControl class
current
get current(): string | undefined;The name of the theme it is in, when it is one by name with nothing changed since
dispose
dispose(): void;Takes the look off the page: it is what packages/client/src/ui/tailwind.css says again
get
get(): Readonly<Tokens>;The values the interface has now
onChange
onChange(listener: (tokens: Readonly<Tokens>) => void): () => void;Calls back whenever the look changes, until what this gives back is called
reset
reset(): void;Back to what the game started with
set
set(spec: ThemeSpec): void;Changes the look: to a theme by name, or values over what it is now ({ accent: '#7fe07a' }), or values worked out from what it is now