Context Variables Reference
These are all of the context variables available to use in your templates, alongside all of the existing Tera built-ins.
Single-Flavor Mode
Section titled “Single-Flavor Mode”| Variable | Description |
|---|---|
flavor (Flavor) | The flavor being templated. |
rosewater, flamingo, pink, etc. (Color) | All colors of the flavor being templated. |
| Any Frontmatter | All frontmatter variables as described in the Frontmatter Reference. |
Multi-Flavor Mode
Section titled “Multi-Flavor Mode”| Variable | Description |
|---|---|
| flavors ( Map<String, Flavor>) | An array containing all of the named flavors, with every other context variable. |
| Any Frontmatter | All frontmatter variables as described in the Frontmatter Reference. |
These types are designed to closely match the palette.json.
Flavor
Section titled “Flavor”- Description: The name of the flavor.
- Type:
String - Examples:
"Latte","Frappé","Macchiato","Mocha"
identifier
Section titled “identifier”- Description: The identifier of the flavor.
- Type:
String - Examples:
"latte","frappe","macchiato","mocha"
- Description: Emoji associated with the flavor.
- Type:
char - Examples:
'🌻','🪴','🌺','🌿'
- Description: Order of the flavor in the palette spec.
- Type:
u32 - Examples:
0to3
- Description: Whether the flavor is dark.
- Type:
bool - Examples:
falsefor Latte,truefor others
- Description: Whether the flavor is light.
- Type:
bool - Examples:
truefor Latte,falsefor others
colors
Section titled “colors”- Description: A map of color identifiers to their respective values.
- Type:
Map<String,Color>
- Description: The name of the color.
- Type:
String - Examples:
"Rosewater","Surface 0","Base"
identifier
Section titled “identifier”- Description: The identifier of the color.
- Type:
String - Examples:
"rosewater","surface0","base"
- Description: Order of the color in the palette spec.
- Type:
u32 - Examples:
0to25
accent
Section titled “accent”- Description: Whether the color is an accent color.
- Type:
bool
- Description: The color in hexadecimal format.
- Type:
String - Examples:
"1e1e2e"
- Description: Big-endian 24-bit color in RGB order.
- Type:
u32 - Examples:
1973806
uint32
Section titled “uint32”- Description: Big-endian unsigned 32-bit color in ARGB order.
- Type:
u32 - Examples:
4280163886
sint32
Section titled “sint32”- Description: Big-endian signed 32-bit color in ARGB order.
- Type:
i32 - Examples:
-14803410
- Description: The color in RGB format.
- Type:
RGB
- Description: The color in HSL format.
- Type:
HSL
opacity
Section titled “opacity”- Description: The opacity of the color.
- Type:
u8 - Examples:
0to255
- Description: The red channel of the color.
- Type:
u8
- Description: The green channel of the color.
- Type:
u8
- Description: The blue channel of the color.
- Type:
u8
channels
Section titled “channels”- Description: An array containing the
[R, G, B]channels of the color. - Type:
[u8; 3] - Examples:
[30, 30, 46]
- Description: The hue of the color.
- Type:
u16
- Description: The saturation of the color.
- Type:
u8
- Description: The lightness of the color.
- Type:
u8