Skip to content

ThemeControl beta ​

Class of @v12-engine/client

ts
export declare class ThemeControl

The 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 ​

ts
constructor(
    initial: ThemeSpec | undefined, element?: HTMLElement | undefined);

Constructs a new instance of the ThemeControl class

current ​

ts
get current(): string | undefined;

The name of the theme it is in, when it is one by name with nothing changed since

dispose ​

ts
dispose(): void;

Takes the look off the page: it is what packages/client/src/ui/tailwind.css says again

get ​

ts
get(): Readonly<Tokens>;

The values the interface has now

onChange ​

ts
onChange(listener: (tokens: Readonly<Tokens>) => void): () => void;

Calls back whenever the look changes, until what this gives back is called

reset ​

ts
reset(): void;

Back to what the game started with

set ​

ts
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