package miaou-core

  1. Overview
  2. Docs
Miaou core/widgets (no drivers, no SDL)

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.5.2.tar.gz
md5=60a3b9f181f24572a06a9492532bfdda
sha512=fcc35a275066be2900e6201782faf47503076fa4640f08cf78067835a6f447b74613009e55b2ac799adb7ca46f1bffa261fc5971753f2cc3c6bef327511c7ef6

doc/miaou-core.style/Miaou_style/Theme_loader/index.html

Module Miaou_style.Theme_loaderSource

Theme loading from JSON files with file discovery and merging.

Theme files are discovered in the following order (later overrides earlier): 1. Built-in default theme (always present) 2. User global: ~/.config/miaou/theme.json 3. Project local: .miaou/theme.json 4. Environment variable: $MIAOU_THEME (path to a specific file)

Named themes can be loaded from:

  • ~/.config/miaou/themes/{name}.json

All discovered theme files are merged, with later files taking precedence.

Configuration

Sourceval search_paths : unit -> string list

Get the list of paths that will be searched for theme files

Sourceval themes_dir : unit -> string option

Get the directory for named themes

Loading

Sourceval load : unit -> Theme.t

Load the effective theme by merging all discovered theme files. Returns the default theme if no files are found.

Sourceval load_named : string -> Theme.t option

Load a specific named theme (e.g., "light", "dark", "high-contrast"). Looks in the themes directory for {name}.json. Returns None if the theme is not found.

Sourceval load_file : string -> (Theme.t, string) result

Load a theme from a specific file path. Returns Error with message if loading fails.

Theme management

Sourceval list_themes : unit -> string list

List available named themes from user themes directory

Sourceval list_all_themes : unit -> (string * string * bool) list

List all available themes (built-in + user themes). Returns a list of (id, display_name, is_builtin) tuples.

Sourceval reload : unit -> Theme.t

Reload the theme (useful after file changes)

Smart loading

Sourceval load_any : string -> Theme.t option

Load a theme by name, checking built-in themes first, then user themes. This is the preferred way to load a theme by name.

Example:

  match Theme_loader.load_any "dracula" with
  | Some theme -> Style_context.set_theme theme
  | None -> (* theme not found *)

Parsing helpers

Sourceval of_json_string : string -> (Theme.t, string) result

Parse a theme from a JSON string

Sourceval to_json_string : ?pretty:bool -> Theme.t -> string

Convert a theme to a JSON string