Paragraph and character style changing variables allow your end users to change the look and feel of your text from a pre-set list of options. This functionality is useful when you would like to allow your end users to change the font size, weight, color, or even the font itself. It can also be used to change your font color based on your document background color. For example, if your blue background needs white text and your white background needs blue text.
NOTE: By creating these paragraph/character style changing variables, your end user will be changing the text everywhere this paragraph or character style is used in your document.
Creating Your Paragraph Styles
When creating a paragraph/character style changing list variable, your end user will be able to select the text file they want via a dropdown. To ensure this selection works properly, you will need to define a “Default” style as well as additional styles for each option you wish to provide your end user.
For example, if you wish to allow your end use to select from a dark blue headline or a light blue headline, you will need to define three total character styles:
- Your default style
- Your dark blue style
- Your light blue style
The “Default” paragraph/character style does not have to be the same one you plan to use in your design, as your end user will never see it. To effectively change these styles, CHILI will fully replace the default style with the new style. By creating and assigning the “Default” style to the text element you want to change, you are allowing the system to fully replace the “Default” style without impacting any of your paragraph or character styles.
If you start your default style with “Default” you will be able to easily find the style you want to replace. Similarly, adding a defining characteristic (font color or size) to the front of your other styles will allow you to more easily find them in your action logic, as well.
Create Your Paragraph or Character Style List Variable
Now that you have defined your styles, you will need to add them to a list variable. This is where you’ll list all the font options you want to give your end user. Your end user will see this list presented as a drop-down variable, so be sure to use names they will recognize.
You will use these list names in your action logic and they need to be word-perfect. A good best practice is to copy them into a word document or sticky note to ensure there are no typos in your action logic.
Writing Your Paragraph or Character Style Changing Action Logic
CHILI uses “action logic” to tell your artwork what you want to change. In this case, you will use action logic to tell CHILI which styles you want to assign to replace your “Default” style. This example uses the Paragraph Style options, but the same concept would apply to Character Styles.
Here are the steps you’ll take to add action logic to your color changing list variable:
- With your style changing list variable selected, navigate to the “Actions” tab in “Variable Settings”
- Click the “Edit” button next to “On Change:”
- The window you will see once you complete step two is where you will assign your action logic. This action logic is essentially an “if-then” statement. You will use the drop-downs in this window to write a code telling CHILI when to change your styles.
- Click the “+” button on the top left to create your first line
- Write your “if” statement using the following drop-downs:
- If > variable > [Your Variable Name] > displayValue > [leave this drop-down blank] > is > string > [Default Style] > [leave this drop-down blank]
- This line of code is telling CHILI if your end user selects a style from your list variable, then a change needs to happen. This is where your style name needs to be word-perfect.
- If > variable > [Your Variable Name] > displayValue > [leave this drop-down blank] > is > string > [Default Style] > [leave this drop-down blank]
- Use the “+” button in the top left to add a second line
- Write your “then” statement using the following drop-downs:
- Set > paragraphStyle > [Default Style] > applyFromStyle > = > paragraphStyle > [Your First Style Option] > id
- This line of code is telling CHILI what you want changed. It’s saying if your end user selects the paragraph style from step one, you want it to push that paragraph style to the default style.
- You want to make sure to replace the default style, because it is being fully replaced by that new paragraph style and you want to make sure you are not replacing an active style.
- Set > paragraphStyle > [Default Style] > applyFromStyle > = > paragraphStyle > [Your First Style Option] > id
- Use the “+” button in the top left to add a third line
- Once this line is added, you’ll notice it is still indented. This means it is still referencing line one.
- When writing your “if” statement for subsequent styles, you will want to start the action logic with “else if”. This tells CHILI you want to start a new action that is unrelated to the action we started in line one.
- Continue adding all of your paragraph style options.
- Click the “Apply” button to complete your action logic.
Once your action logic is complete, you will notice your default style is still applied to your design. This is expected behavior. Navigate to the “Variables” tab on the right toolbar. From here, you can use the style changing list variable to choose your paragraph or character styles from the drop-down. As you do this, your default style will be replaced and you will only see the options you assigned in your action logic.
Save your file and you are now ready to create your Smart Template in Tempo.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article