Skip to main content
Version: 0.1.22

template

Generate output using custom templates.

Description

The template system allows you to customise how tinct generates configuration files for any plugin. You can override built-in templates to adjust output format, add custom settings, or support additional configuration options.

How it works

Each output plugin uses Go templates to generate configuration files. These templates have access to the full theme data including all 49+ colour roles. You can override any template by placing a custom version in:

~/.config/tinct/templates/<plugin-name>/<template-file>

Viewing available templates

List templates for a specific plugin:

tinct templates list --plugin hyprland

Dumping templates for customisation

Export a plugin's templates to the custom directory:

tinct templates dump --plugin hyprland

This copies all templates to ~/.config/tinct/templates/hyprland/.

Export a specific template:

tinct templates dump --plugin hyprland --file tinct-colours.conf.tmpl

Template location precedence

When generating output, tinct checks for templates in this order:

  1. Custom template: ~/.config/tinct/templates/<plugin>/<filename>
  2. Versioned template: Embedded template for specific target version
  3. Default template: Embedded default template

Writing custom templates

Templates use Go's text/template syntax with additional helper functions.

Available data

{{ .Palette.Colours.background.Hex }}     // #1e1e2e
{{ .Palette.Colours.foreground.Hex }} // #cdd6f4
{{ .Palette.Colours.accent1.Hex }} // #89b4fa
// ... all 49+ colour roles

Template functions

FunctionDescriptionExample
hexGet hex colour{{ hex .Palette.Colours.background }}
rgbGet RGB tuple{{ rgb .Palette.Colours.background }}
rgbaGet RGBA with alpha{{ rgba .Palette.Colours.background 0.8 }}
stripHashRemove # from hex{{ stripHash .Palette.Colours.background.Hex }}
toUpperUppercase string{{ toUpper .Palette.Colours.background.Hex }}

Example custom template

# Custom Hyprland colours
# Generated by tinct

$background = {{ .Palette.Colours.background.Hex }}
$foreground = {{ .Palette.Colours.foreground.Hex }}
$accent = {{ .Palette.Colours.accent1.Hex }}

# My custom addition
$gradient_start = {{ .Palette.Colours.accent1.Hex }}
$gradient_end = {{ .Palette.Colours.accent2.Hex }}

Versioned templates

Some plugins support versioned templates for compatibility with different application versions. For example, Hyprland's configuration syntax changes between versions.

Versioned templates are stored in:

templates/0.53/tinct-colours.conf.tmpl
templates/0.52/tinct-colours.conf.tmpl

Tinct automatically selects the appropriate template based on the detected application version.

Resetting to defaults

Remove custom templates to revert to defaults:

rm -rf ~/.config/tinct/templates/hyprland

See also