Creating Styles
Styles are defined in Stylesheets. Stylesheets are functions that return the style settings for a given class name. In this topic, we will cover adding new styles to an existing stylesheet. Creating new stylesheets is covered separately.
To add a new style to an existing stylesheet, we just need to create an extension to the stylesheet function and add clauses to it that define the new styles. See Extending Object Definitions for information about extending functions.
In this example, we will add a new class name and extend the Standard stylesheet to include a definition for the new style. The steps are:
- Create a new Object Module in either the current document or in a library.
- In that module, create the StyleSheets namespace and create an object definition for the new class. In this example, we will use MyAddedClass. The MyAddedClass object should be typed as ClassName.
- Create an extension for the standard stylesheet function. This function is called StandardStyleSheet. The type for this object needs to be ClassName → Style.
- Add a clause for MyAddedClass to the extension of StandardStyleSheet. At this point your new Object Module should look something like:
The new style will only be available in the current document if the new Object Module is in the current document. If the new module is in a library, the new style will be available in any document that references the library.