Skip to content

How to Work With Template Constants

Template constants are named values that belong to one template. Use them when several layers or nested templates should share the same color, font, number, or text value. Changing the constant updates every layer that is still linked to it, which makes broad design changes faster and more consistent.

Choose a constant type

TypeUse it for
ColorReuse one color in the template background, layer fills, strokes, paints, and other compatible color controls.
FontReuse one typeface in text, tick-label, and other compatible font controls.
NumberPass a shared numeric value into a compatible variable exposed by a nested template layer.
TextPass shared wording into a compatible text variable exposed by a nested template layer.

Color and font constants can be selected directly in compatible layer controls. Number and text constants are currently used as parent values for nested template variables; ordinary number and text boxes do not provide a direct constant picker.

Create a constant

  1. Open the template in Studio and find "Template Constants" in the Template Editor.
  2. Choose "Add constant".
  3. Enter the name shown in the editor under "Display name".
  4. Review "Variable name". It must start with a letter or underscore and can contain only letters, numbers, and underscores. It must also be unique within the template.
  5. Choose "Color", "Font", "Number", or "Text" under "Type".
  6. Set the initial "Value" and choose "Create".

The variable name is generated from the display name until you edit it. Choose a stable variable name because it identifies the constant inside layer and nested-template connections.

Configure an existing constant

The current constants appear under "Template Constants". Change a color, number, or text value directly in its control. Choose a font constant to open the font chooser and replace its typeface. A new font constant starts with a generally available font so that you can create it before choosing the final typeface.

Changing a constant changes every consumer that remains connected to it. Preview the complete template after changing a shared value, especially when a new font or longer text can change spacing.

Use a color constant in a layer

  1. Select the layer that should use the shared color.
  2. Open a compatible fill, stroke, background, or paint control.
  3. Choose the named constant from the available template colors.
  4. Repeat for any other layers that should follow the same value.

Choosing a literal color later replaces the connection for that one control. Other controls using the constant remain connected.

Use a font constant in a layer

  1. Select a text layer or another layer with a font control.
  2. Choose "Font" or the applicable label-font control.
  3. Select the named constant from the template font choices.

Choosing a specific font later replaces the connection for that one layer or control. Changing the constant no longer changes that disconnected selection.

Pass constants into a nested template

  1. Add or select a nested template layer.
  2. Find "Template Variables" in that layer.
  3. Locate the child template variable you want to supply.
  4. Set "Mode" to "From parent".
  5. Under "Parent", choose a compatible constant from the current template.

Only constants of the matching type are offered. Set "Mode" to "Value" to give that nested layer its own literal value instead. Choose "Clear" to remove the override and return to the child template's default value.

Remove a constant

  1. Choose "Remove constant" under "Template Constants".
  2. Choose the X beside the constant you want to remove.
  3. Choose "Done" when you have finished removing constants.

Shred Scopes prevents deletion while the constant is still used by the background, a layer, or a nested-template connection. The editor identifies the consumers it finds. Replace or clear those references, then remove the constant again.

Save the custom template after creating, changing, connecting, or removing constants. Constants are local to that template; changing a similarly named constant in another template does not change this one.