Logo FSBarV1_Archived

StylePreset Module

Preset file I/O (JSON format).

Functions and values

Function or value Description

applyToConfig preset config

Full Usage: applyToConfig preset config

Parameters:
Returns: VizConfig

Apply a StylePreset to a VizConfig, returning updated config. Unknown keys are silently skipped; missing keys retain current values.

preset : StylePreset
config : VizConfig
Returns: VizConfig

delete name

Full Usage: delete name

Parameters:
    name : string

Returns: Result<unit, string>

Delete a preset by name. Returns Error if file does not exist.

name : string
Returns: Result<unit, string>

fromConfig name config

Full Usage: fromConfig name config

Parameters:
Returns: StylePreset

Convert current VizConfig to a StylePreset with the given name.

name : string
config : VizConfig
Returns: StylePreset

isValidName name

Full Usage: isValidName name

Parameters:
    name : string

Returns: bool

Returns true if `name` contains only filesystem-safe characters (alphanumeric, spaces, hyphens, underscores) and is non-empty.

name : string
Returns: bool

listNames ()

Full Usage: listNames ()

Parameters:
    () : unit

Returns: string list

List all available preset names (derived from filenames in preset directory).

() : unit
Returns: string list

load name

Full Usage: load name

Parameters:
    name : string

Returns: Result<StylePreset, string>

Load a preset by name. Returns Error if file missing or malformed.

name : string
Returns: Result<StylePreset, string>

presetDirectory

Full Usage: presetDirectory

Returns: string

Directory where presets are stored (`/viz-presets/`).

Returns: string

save preset

Full Usage: save preset

Parameters:
Returns: Result<string, string>

Save a preset to disk. Overwrites if a preset with the same name exists. Returns Ok with the full file path, or Error with a descriptive message.

preset : StylePreset
Returns: Result<string, string>

Type something to start searching.