Filters Reference
These are all of the filters available to use in your templates, alongside all of the existing Tera built-ins.
- Description: Add a value to a color
- Attributes
hue:i32(degrees)saturation:u8(0–100)lightness:u8(0–100)opacity:f32(0.0–1.0)
- Example:
red | add(hue=30)⇒ff6666
- Description: Subtract a value from a color
- Attributes
hue:i32(degrees)saturation:u8(0–100)lightness:u8(0–100)opacity:f32(0.0–1.0)
- Example:
red | sub(hue=30)⇒d30f9b
- Description: Modify a color
- Attributes
hue:i32(degrees)saturation:u8(0–100)lightness:u8(0–100)opacity:f32(0.0–1.0)
- Example:
red | mod(lightness=80)⇒f8a0b3
- Description: Mix two colors together
- Attributes
coloramount:f32(0.0-1.0)
- Example:
red | mix(color=base, amount=0.5)⇒e08097
urlencode_lzma
Section titled “urlencode_lzma”- Description: Serialize an object into a URL-safe string with LZMA compression
- Example:
some_object | urlencode_lzma⇒"XQAAgAAEAAAAAAAAAABAqEggMAAAAA=="
- Description: Truncate a number to a certain number of places
- Example:
1.123456 | trunc(places=3)⇒1.123
- Description: Fetch a color’s hex representation. Shortcut for
get(key="hex"). - Example:
red | hex⇒d20f39
css_rgb
Section titled “css_rgb”- Description: Convert a color to an RGB CSS string
- Example:
red | css_rgb⇒rgb(210, 15, 57)
css_rgba
Section titled “css_rgba”- Description: Convert a color to an RGBA CSS string
- Example:
red | css_rgba⇒rgba(210, 15, 57, 1.00)
css_hsl
Section titled “css_hsl”- Description: Convert a color to an HSL CSS string
- Example:
red | css_hsl⇒hsl(347, 87%, 44%)
css_hsla
Section titled “css_hsla”- Description: Convert a color to an HSLA CSS string
- Example:
red | css_hsla⇒hsla(347, 87%, 44%, 1.00)