Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Template files

andrewandreii edited this page Jun 8, 2025 · 1 revision

Template files

These are files (usually) located at ~/.config/matey/ and can have any extension you want (useful for syntax highlighting)

Templates

Templates can either be in template blocks:

norm {
primary = {primary}
}

Or in strings:

#out "{CONFIG}/app/config.conf"

Keys

The basic form is {keyname}

In normal mode:

Key name Description
color (ie. primary) By default outputs red, green and blue in hex
image The path to the image matey got
CONFIG The path to the config folder matey is using
HOME The HOME environmental variable

In foreach mode:

Key name Description
name The name of the variable (default naming is snake_case, but it can be changed via #naming)
color By default outputs red, green and blue in hex

Key indexing

Some keys can be indexed, this means that the name can be followed by an array of characters ({color.anycharacters})

Indexing colors:

Indexes Description
r, g, b, a The hex representation of the color component
R, G, B, A The decimal representation of the color component

By default: {color.rgb}

Tip: Any key or index that matey can't find will get ignored and matey will warn you about this

Escaping

Escaping is done with \ and can only be used with {. Once the first { is escaped the second doesn't need to be escaped:

norm {
primary = \{ "color" = {primary} }
}

Template blocks

These are types followed by a template surrounded by {}.

Type Description
norm Will run once and you have access to all keys in normal mode
foreach Will run once for each color and you only have access to the keys in foreach mode

Tip: The order of template blocks matters, that is the order they will have in the output file

norm {
begin
}

norm {
end
}

Will output:

begin
end

Tip: the newline after { is optional and ignored, but the newline before } is written as is:

foreach {
foo}

Will output:

foofoofoofoo...

But

foreach {
foo
}

Will output:

foo
foo
...

Template strings

Like template blocks in normal mode, except they cannot contain newlines

// Invalid
#out "{HOME}/
output"

//Valid
#out "{HOME}/output"

Commands

Commands start with #

Name Description
out The output file for this template
naming The naming scheme for color names (can be: "snake_case", "dash-case", "camelCase", "CamelCase", "UPPERCASE", "UPPER_CASE", "lowercase")

Clone this wiki locally