Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Page layout facilities > Styles > Question, response, and information text > Colors
 
Colors
Question, categorical response, and information texts have two colors associated with them: the color of the text itself and the background of the area that the text covers. The following example shows blue question text on a yellow background:
This graphic is described in the surrounding text.
In the Metadata section
To define text colors in the metadata section, include the following element as part of the question, response, or information text definition:
labelstyle([color = "TextColor"][, bgcolor = "TextBgColor"])
where:
TextColor is the color for the text.
TextBgColor is the color for the text background.
You can specify colors using names or RGB values entered in hexadecimal format. The previous illustration was created by the statement:
Sports1 "Which of the following sports do you play?"
labelstyle(color = "blue", bgcolor = "yellow") categorical [1..]
{Tennis, Football, Cricket, Basketball, Hockey};
This is the same as writing:
Sports2 "Which of the following sports do you play?"
labelstyle(color = "#0000FF", bgcolor = "#FFFF00") categorical [1..]
{Tennis, Football, Cricket, Basketball, Hockey};
For a complete list of the color names that you can use and their equivalent RGB (hexadecimal) values, see your HTML documentation.
You use the same syntax when you want to define colors for response texts, except that you place the labelstyle element next to the response text that it refers to. For example:
Sports3 "Which of the following sports do you play?" categorical [1..]
{
Tennis labelstyle(color = "blue", bgcolor = "yellow"),
Football labelstyle(color = "red"),
Cricket labelstyle(color = "green"),
Basketball labelstyle(bgcolor = "pink"),
Hockey labelstyle(color = "blue")
};
produces the following page:
This graphic is described in the surrounding text.
Notice that the color and bgcolor parameters can be used independently to control just the text or text background color. If a parameter is not defined, the default color is used. The system defaults are black text on a white background but you can set different defaults using default styles or templates.
The settings for one response do not carry over onto subsequent responses: if consecutive responses use the same color scheme, you can do any of the following:
Enter a separate labelstyle keyword for each response.
Specify the colors for the response control as a whole using the style keyword after the question text. For more information, see Colors for categorical response lists.
Define colors in the routing section.
In the routing section
In the routing section, any statement to do with text defined in the script uses the Label object in the Interview Object Model in some way. The sort of text that the Label object refers to depends on the object to which it is attached (its parent object). Anything to do with the visual appearance of an item on the page is controlled by the Style object, so any statement to do with the visual appearance of questionnaire text will always include the notation Label.Style.
Question and information text
To define the color of a question or information text, type:
Qname.Label.Style.Color = "color"
To define the background color of a text, type:
Qname.Label.Style.BgColor = "color"
where:
Qname is the name of the question or information item.
color is the name or hexadecimal RGB value of the color you want to use.
The statements to produce blue question text on a yellow background, as shown in the earlier illustration, are:
Sports.Label.Style.Color = "blue"
Sports.Label.Style.BgColor = "yellow"
Categorical response texts
To define colors for categorical response texts, type:
Qname.Categories[{Name}].Label.Style.Color = "color"Qname.Categories[{Name}].Label.Style.BgColor = "color"
where:
Qname is the question name.
Name is the name of the response whose color you are defining. If you want to apply the same setting to all categorical response texts in a list, you can replace the [{Name}] notation with [..].
color is the name or hexadecimal value of the color you want to use.
Here are some examples. The first one displays blue response texts on a yellow background:
Sports.Categories[..].Label.Style.Color = "blue"
Sports.Categories[..].Label.Style.BgColor = "yellow"
This graphic is described in the surrounding text.
The following example replicates the earlier example in which each response text has a different color and background color.
Sports.Categories[{Tennis}].Label.Style.Color = "blue"
Sports.Categories[{Tennis}].Label.Style.BgColor = "yellow"
Sports.Categories[{Football}].Label.Style.Color = "red"
Sports.Categories[{Cricket}].Label.Style.Color = "green"
Sports.Categories[{Basketball}].Label.Style.BgColor = "pink"
Sports.Categories[{Hockey}].Label.Style.Color = "blue"
See also
Question, response, and information text