PTC ALD in Arbortext Styler > Components of Documents and Templates > Style Components > Colors > Inline Colors
  
Inline Colors
This sample code provides an inline instruction for setting color:
var s = new fStyle;
s.color="green";
where green s a valid color name in PTC Arbortext Layout Developer.
Color definitions for the colors specified by name in the Arbortext Styler integration are different from those in the PTC Arbortext Layout Developer— Desktop product. In the integration, PTC ALD matches the colors from the FOSI engine.
The color green has been pre-defined in PTC Arbortext Layout Developer’s own color book. PTC Arbortext Layout Developer also provides color books for CSS and Pantone colors. To call a color from the CSS color book, use code as shown in this example:
var s = formatting.currentStyle;
s.color = "'_css_:green'";
Single quotes inside the double quotes must be included. This will be improved in a future version of PTC Arbortext Layout Developer.
To use a Pantone color, use the name used by PTC Arbortext Layout Developer. The colors are defined in the PTC Arbortext Layout Developer— Desktop interface.
Specific color values can be defined in a number of different ways, depending on the information available. These examples show how to define colors:
To specify CMYK colors:
var s = formatting.currentStyle;
s.color = "cmyk(200,10,30,50)";
where the color values are in the 0–255 range.
To specify color in RGB:
var s = formatting.currentStyle;
s.color = "rgb(200,10,50)";
where the color values are in the 0–255 range.
To declare a color using percentage values:
var c = new fColor("cmyk(100%,20%,60%,20%)");
this method can be used for RGB and CMYK colors.
To use values inside braces:
var c = new fColor("{10,100,10}");
where the values are in the 0–100 range.
The entry of three values implies an RGB color and four values implies a CMYK color.
To declare a color with its hex value:
var c = new fColor("#00FFA099");
The entry of three values implies an RGB color and four values implies a CMYK color.
The fColor object is used to specify a color on numerous objects in PTC Arbortext Layout Developer, from text color to background colors and rules. The fColor object allows you to define a color inline and use it immediately. The object must be saved to make the color available for reuse, for example saved on the fTemplate object.