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?
optionalbaseGrid?:GridOptionsPatch
Defined in: ui/src/appearance.ts:268
Grid under the overrides. Default: the chart's grid when the appearance is created.
baseTheme?
optionalbaseTheme?: () =>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
container?
optionalcontainer?:HTMLElement
Defined in: ui/src/appearance.ts:305
Element the panel opens in. Default the chart's root.
defaultPreset?
optionaldefaultPreset?: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?
optionalmode?: () =>"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?
optionalpresets?:false| readonlyColorPreset[]
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?
optionalstorage?:AppearanceStorage|null
Defined in: ui/src/appearance.ts:270
Where to keep overrides; null keeps them for this visit only. Default localStorage.
storageKey?
optionalstorageKey?: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()?
optionalonOpenChange(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()?
optionalonPresetChange(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()?
optionalsetMode(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