Background Color changing script for Press
To script a color in Press is pretty simple. Here are the steps to do so:
Create the background object using the Rectangle tool, or any other shape tool available in the Insert tab.
Add this Python function to the Functions section in the Properties window.
def background_color(color):
return color
Copy the function ‘background_color(color)’ to your clipboard, and select your background object.
Select the Expressions tab in the Properties window with the background object selected, and Paste your background_color function into the ‘Background:’ input box. Use the Tab key to initiate the change.
A new window will appear, asking for a value for a new variable called color. Type in the color you want (ex: Red, Green, Blue, Transparent, or a hexcode value).
Click OK to save changes and close the variable window. The object should now be the color entered.
To further customize this, the ‘color’ variable can be mapped to a Controller database column to receive the color displayed if that value is in the Person’s record. Conditions can be added to the background_color() function to return different values.
An example of a temple demonstrating this is attached to this document.