Skip to content

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
  • Example: red | add(hue=30)#ff6666
  • Description: Subtract a value from a color
  • Example: red | sub(hue=30)#d30f9b
  • Description: Modify a color
  • Example: red | mod(lightness=80)#f8a0b3
  • Description: Mix two colors together
  • Example: red | mix(color=base, amount=0.5)#e08097
  • Description: Serialize an object into a URL-safe string with LZMA compression
  • Example: red | urlencode_lzma#ff6666
  • Description: Truncate a number to a certain number of places
  • Example: 1.123456 | trunc(places=3)1.123
  • Description: Convert a color to an RGB CSS string
  • Example: red | css_rgbrgb(210, 15, 57)
  • Description: Convert a color to an RGBA CSS string
  • Example: red | css_rgbargba(210, 15, 57, 1.00)
  • Description: Convert a color to an HSL CSS string
  • Example: red | css_hslhsl(347, 87%, 44%)
  • Description: Convert a color to an HSLA CSS string
  • Example: red | css_hslahsla(347, 87%, 44%, 1.00)