package miaou-core
Install
dune-project
Dependency
Authors
Maintainers
Sources
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
Get the list of paths that will be searched for theme files
Get the directory for named themes
Loading
Load the effective theme by merging all discovered theme files. Returns the default theme if no files are found.
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.
Load a theme from a specific file path. Returns Error with message if loading fails.
Theme management
List available named themes from user themes directory
List all available themes (built-in + user themes). Returns a list of (id, display_name, is_builtin) tuples.
Smart loading
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 *)