fn: sgnd_ui_set_theme
Purpose
Select and source a palette and style file for the current shell session.
Behavior
- Resolve palette and style files against SGND_UI_THEME_DIR or explicit paths.
- Source palette before style, and check that palette defines RESET.
- Set SGND_UI_PALETTE_FILE and SGND_UI_STYLE_FILE only after both load.
Arguments
--palette NAME|PATH— Palette name or file path.--style NAME|PATH— Style name or file path.--default— Use the built-in default palette and style.-h,--help— Display help.PALETTE STYLE— Alternatively, pass palette and style as positional values.
Inputs (globals)
SGND_UI_THEME_DIR; optionally SGND_FRAMEWORK_ROOT.
Outputs (globals)
Palette/style shell variables; SGND_UI_PALETTE_FILE; SGND_UI_STYLE_FILE.
Output
Writes help or diagnostics; otherwise no output on success.
Returns
- 0 when the palette and style load successfully, or for
--help. - 2 for unexpected arguments.
- 3–5 for theme file lookup errors; 10–12 for palette/style load errors.
Usage
sgnd_ui_set_theme --default
sgnd_ui_set_theme --palette default-ui-palette --style 00-style-default
Notes
Sourcing theme files can modify the current shell even if a later validation fails.
