Skip to content

charton API


charton API / @chart-on/ui / index / AppearanceOptions

Interface: AppearanceOptions ​

Defined in: ui/src/appearance.ts:264

Options for createAppearance: the base theme and grid, where overrides are saved, the color presets offered, and open/close and preset callbacks.

Properties ​

baseGrid? ​

optional baseGrid?: GridOptionsPatch

Defined in: ui/src/appearance.ts:268

Grid under the overrides. Default: the chart's grid when the appearance is created.


baseTheme? ​

optional baseTheme?: () => ChartTheme

Defined in: ui/src/appearance.ts:266

Theme under the overrides; read again on every apply, so a dark/light switch keeps them.

Returns ​

ChartTheme


container? ​

optional container?: HTMLElement

Defined in: ui/src/appearance.ts:305

Element the panel opens in. Default the chart's root.


defaultPreset? ​

optional defaultPreset?: string | null

Defined in: ui/src/appearance.ts:287

Id of the preset used until the user picks one; null starts from the base theme. Default 'paper-ink'. A saved choice, the default theme included, wins.


mode? ​

optional mode?: () => "dark" | "light"

Defined in: ui/src/appearance.ts:292

Light or dark: which variant of each preset applies. Default: what the base theme's background reads as, then what the panel's Light and Dark buttons chose.

Returns ​

"dark" | "light"


presets? ​

optional presets?: false | readonly ColorPreset[]

Defined in: ui/src/appearance.ts:282

Colour presets offered at the top of the panel. Default builtInColorPresets; an array replaces the list; false hides the section and ignores a saved preset.


storage? ​

optional storage?: AppearanceStorage | null

Defined in: ui/src/appearance.ts:270

Where to keep overrides; null keeps them for this visit only. Default localStorage.


storageKey? ​

optional storageKey?: string

Defined in: ui/src/appearance.ts:275

localStorage key of the default storage. Default 'charton:appearance'. Give each chart on a page its own key, or they share (and overwrite) one set of choices.

Methods ​

onOpenChange()? ​

optional onOpenChange(open): void

Defined in: ui/src/appearance.ts:277

Called when the panel opens or closes, e.g. to refresh a toolbar button's pressed state.

Parameters ​

open ​

boolean

Returns ​

void


onPresetChange()? ​

optional onPresetChange(preset): void

Defined in: ui/src/appearance.ts:303

Restyle after the preset or its mode changed. Replaces the default, which applies theme() to the chart; the shell also restyles its chrome here.

Parameters ​

preset ​

ColorPreset | null

Returns ​

void


setMode()? ​

optional setMode(mode): void

Defined in: ui/src/appearance.ts:298

Switch the mode from the panel's Light and Dark buttons, then restyle. Replaces the default, which only switches the preset's variant (the base theme stays); the shell switches its theme here.

Parameters ​

mode ​

"dark" | "light"

Returns ​

void