Stylesheet Development with PTC ALD > Adding PTC ALD Code to Stylesheet Source > Samples > Testing > Test Attribute Values and Apply Formatting Properties > Set Text Color
Set Text Color
The sample listed here describes how to set text color for a piece of inline text based on the current value of one of its attributes.
Refer to the emphasis in para in sect1[2] context in the stylesheet Arbortext-path/samples/ALD/Testing/Attributes/ The context includes an PTC ALD source code edit. The relevant code is shown below:
style.color = arguments[0].attributes.role;
The first part of the phrase style.color specifies that you want to provide a value for the color property for the style of the context, which is based on an fStyle object. The second half = arguments[0].attributes.role confirms that the role attribute on the current element will provide the value for the color property.
So if the inline text appears as <emphasis role=”red”>Inline text</emphasis> in the document source, the value of the color property for the style created for that text is red.