Theming with Matugen
This explains how Tsumiki integrates with Matugen to generate Material You color palettes from a wallpaper or image, and how to control it.
Add a matugen section to your theme.json (or edit the existing one). Example:
"matugen": { "enabled": true, "wallpaper": "~/Pictures/wallpaper.jpg", "scheme": "scheme-tonal-spot", "mode": "dark", "contrast": 0.0}Fields
Section titled “Fields”enabled(bool): If true, Tsumiki will attempt to generate a palette at startup when the service is available.wallpaper(string): Path to the image used to extract colors. Can be an absolute path or~expansion.scheme(string): Matugen scheme identifier. Common choices:scheme-tonal-spot(default)scheme-contentscheme-expressivescheme-fidelityscheme-fruit-saladscheme-monochromescheme-neutralscheme-rainbow
mode(string):darkorlightoutput mode.contrast(float): Contrast adjustment between -1.0 and 1.0.
Config file
Section titled “Config file”Tsumiki ships a Matugen config template at assets/matugen/config.toml. The service uses ~/.config/tsumiki/assets/matugen/config.toml by default. If you want a custom config file, edit that path in the service or copy the template and adjust it.
Running Matugen
-
Automatic: When
matugen.enabledis true, Tsumiki’s startup code will call the Matugen service and generate the palette before compiling CSS. -
Manual (shell): You can run Matugen directly from the command line (Matugen must be installed):
matugen image -q ~/Pictures/wallpaper.jpg -t scheme-tonal-spot --mode dark --contrast 0.0 --config ~/.config/tsumiki/assets/matugen/config.toml- Manual (from inside Tsumiki/python): use the service exposed by the app (when running inside the Tsumiki environment):
from services.matugen import MatugenServicemat = MatugenService()mat.generate_sync('/home/user/Pictures/wallpaper.jpg')# ormat.generate('/home/user/Pictures/wallpaper.jpg') # asyncTroubleshooting
Section titled “Troubleshooting”- Ensure the
matugenbinary is installed and onPATH. - Ensure the
wallpaperpath exists and is accessible. - If you see caching or stale values, restart Tsumiki to force regeneration.
- If you get import/cache issues after code edits, remove
*.pycand__pycache__directories and restart.
- Matugen produces color variables that are consumed by
styles/theme.scsswhen Tsumiki compiles CSS. Editing the Matugen config or wallpaper requires regenerating the palette and recompiling CSS. - The service emits signals (
colors_generatedandgeneration_failed) that other parts of Tsumiki can listen to for live updates.
Examples
- Quick one-liner (generate and recompile CSS manually):
matugen image ~/Pictures/wallpaper.jpg -t scheme-tonal-spot --mode dark --contrast 0.0 --config ~/.config/tsumiki/assets/matugen/config.toml && ./init.sh -recompile- Interactive (Python REPL within Tsumiki venv):
from services.matugen import MatugenServicem = MatugenService()m.generate_sync('~/Pictures/wallpaper.jpg')That’s it — enable matugen in theme.json, ensure matugen is installed, and Tsumiki will pick up the generated palette on startup or when you trigger the service manually.