About Workbench themes

Workbench themes options allow you to customize the appearance of the Workbench display. Generally speaking, a theme is a predefined collection of design elements that determine the way an application appears to the user. Within the Niagara Framework, a theme is a module that controls the appearance of Workbench on the local computer by defining fonts and colors, as well as the icons, used in the Workbench display. Choosing a different theme affects only the Workbench appearance, there is no other impact.

You can customize your Workbench display by selecting the theme that you prefer. In addition to permitting you to customize your Workbench display, themes can also be used to give Workbench a “branded” appearance.

Types of themes

Within Workbench, there are standard “built-in” themes that you can use. You can also create and use custom themes. The built-in themes are installed as part of the Workbench application. Starting in AX-3.7, there are three built-in themes available for use, as shown below in Figure 78:

  • Frost

    Displays a medium-blue color scheme with many custom icons.

  • Lucid

    Displays a blue and gray color scheme. This is the theme applied to Workbench by default.

  • Palladium

    Displays a gray color scheme.

Figure 78. Workbench Built-in Themes


Workbench Built-in Themes


To change the Workbench theme, click Tools->Options to see the active theme in the General tab. Click the Active theme drop-down arrow and click on a different theme option to select it, as shown in Figure 79. In order for the theme change to take effect, you must exit Workbench and restart it.

Figure 79. Active Theme drop-down in General settings


Active Theme drop-down in General settings


NoteTo save changes made in Workbench Options, such as a theme change, you must close/exit Workbench using File menu options or click the window’s close box (). Closing Workbench in the console will not cause those changes to be saved.

Define a default custom theme for your brand

You can do this by creating a new custom theme module that specifies colors (such as, corporate colors), fonts, and icons to be used in the Workbench display and designating this as the default theme. Workbench automatically selects this theme if the user does not make another selection. You can also “force” the use of the default theme, effectively locking Workbench into using the default theme.

Designate a default theme

This procedure explains how to designate a default theme and lock it.

  1. Open the brand.properties file in the /lib folder and add the following two lines of text, replacing “themeName” with your custom theme name, as shown in Figure 80:

    workbench.theme.default=themeName

    workbench.theme.locked=true

    Figure 80. Text to designate default theme and lock it.


    Text to designate default theme and lock it.

  2. Click File->Save to save your changes in the brand.properties file.

  3. Restart Workbench for this change to take affect.

NoteLocking the theme hides the Active theme drop-down, normally visible in Workbench Options, so that no other theme can be selected.

About theme modules

As with all Workbench modules, a theme module contains the build.xml and module-include.xml files. A module is identified as a theme module by adding a <defs> tag with a themeName definition within module-include.xml, as shown below:

Figure 81. <defs> tag within module-include.xml file.


<defs> tag within module-include.xml file.


Also required in a theme module, is at least one text file with the extension .nss located in /src/nss. A Niagara Style Sheets (NSS) file is used to enable styling of fonts, colors, and other attributes of the Workbench display using syntax and keywords similar to those used in HTML Cascading Style Sheets (CSS).

NoteAlthough NSS shares some syntax and keywords with CSS, the languages are not the same. NSS performs cascading like CSS, however the syntax is different. Also, NSS has no positioning selectors while CSS has many. Refer to the “NiagaraAX Developers Guide” for more details.

All of the resources files (NSS files, .PNG, etc.) for you theme module must be located under the /src folder and must be specified within build.xml with the standard <resources> tag:

<resources name="nss/*.*" />

NoteWith all resources tags, you must omit the “/src” directory from the value provided for the “name” attribute.

You can override any Workbench icons with custom icons in your theme module. Your custom icon image files (*.PNG) must be located in the /src/imageOverrides folder within your theme module. Subfolders within /imageOverrides correspond to the name of the module containing the icons you wish to override. For example, to override a Workbench icon located in the icons module your .PNG file must be located in /imageOverrides/icons/x16 in your theme module and that exact path must be specified in a resources tag within the build.xml file for your theme module:

<resources name="imageOverrides/icons/x16/*.*" />

NoteWhen overriding icons your must duplicate the original filenames and folder structure exactly. Otherwise, the path to the icons will be incorrect and the custom icons will not display. You can determine the correct path and filenames to use by examining the feature whose icons you want to override and look inside the corresponding module for the path to those icon files.

For example, if overriding the alarm icon in the alarm module, first examine the contents of the alarm module and note the filename and path to that icon (alarm/com/tridium/alarm/icons/alarm.png), as shown in Figure 82. Next, duplicate that path under the /imageOverrides folder in your theme module, placing your image file named alarm.png in: /imageOverrides/alarm/com/tridium/alarm/icons. Next, specify the exact path in a resources tag within the build.xml file for your theme module:

<resources name="imageOverrides/alarm/com/tridium/alarm/icons/alarm.png" />

Figure 82. Determine filename and path to icon for override


Determine filename and path to icon for override

Also, you can have several themes sharing the same set of custom icons by placing multiple NSS files inside the /src/nss folder. Each of the NSS files will be individually selectable as a separate theme in the Active Theme drop-down. Doing this eliminates the need to have duplicate sets of icons in separate theme modules.

The following procedures describe how to:

Create a new theme module

This procedure describes the steps used to create a new theme module.

  1. In the Workbench Nav pane, under My File System, navigate to Niagara 3.7.x and expand it. Create a new /themes subfolder there to store your custom themes. This is where the new theme module that you create will be located.

  2. Click Tools->New Module and fill-in the fields in the New Module dialog box, as shown in Figure 83.

    • Enter the path to the /themes folder created above (for example: C:/niagara/Niagara-3.7.x/themes).

    • Enter a name for the theme using this naming convention, themeName (for example: themeCitrus).

    • Enter a Preferred Symbol (four-letter abbreviation) for the new theme name (for example: thci).

    • Enter a Description (for example: Niagara Workbench theme module).

    • Enter a Vendor (for example: Tridium).

    • Clear the checked check box for Create Lexicon and click the Next button to advance to the next screen.

    Figure 83. New Module dialog box


    New Module dialog box

  3. Remove any Dependencies listed in the dialog box and click the Next button.

  4. No Packages are required. Click the Finish button to create the new module.

    The new module contains the two required XML files: build.xml and module-include.xml, as shown in Figure 84.

    Figure 84. New module


    New module


  5. Using a text editor, open module-include.xml and add the <defs> tag to identify this module as a theme module, as shown in Figure 85:

    Figure 85. Add <defs> tag in module-include.xml


    Add <defs> tag in module-include.xml


Copy resources from a built-in theme module

This procedure describes how to obtain resources from another theme module and add appropriate resources tags to the build.xml file in the new theme module.

In addition to the .xml files mentioned earlier, the theme module requires that at least one Niagara Style Sheet (NSS) file be located in: /src/nss. Copying an existing NSS file, along with other resources, from one of the built-in themes will save time and reduce the chance of introducing errors.

  1. In the Nav pane under My File System, navigate to your new theme module in the /themes folder. Create a new subfolder there named /src (for example: /themes/themeCitrus/src). This is where all resources must be located.

  2. In the Nav pane under My Modules, scroll down to locate the built-in theme modules (themeFrost.jar, themeLucid.jar, themePalladium.jar).

    Double-click themeLucid.jar to display its resources. Select all the resource folders and copy them.

  3. Under My File System, navigate to your new theme module in the /themes folder, and paste the copied resource folders into the /src subfolder.

  4. Using a text editor, open the build.xml file in your theme module and add a <resources> tag for each folder copied from the built-in theme module , as shown in Figure 86:

    Figure 86. Specify resources in build.xml


    Specify resources in build.xml


    At this point, your new theme module has everything needed to build a .jar file. However, since the NSS file was copied from another theme, your new theme will have an identical appearance. To make your new theme distinguishable from the other, you must change design elements within the NSS file.

Modify design elements in the NSS file

This procedure briefly describes an approach to modifying design elements in an NSS file to give Workbench a unique appearance.

  1. In the Nav pane under My File System, navigate to your theme module and expand it to access the NSS file in /src/nss. Using a text editor, open the NSS file and scroll to the Define statements (#define...) located at the top of the NSS file. These statements define certain font and color styles that typically are applied repeatedly throughout the NSS file. Modifying a few color definitions in the #define statements will have the most noticeable impact on the Workbench display.

    Colors may be specified as RGB colors in hexadecimal format (for example: #000, #ffffff ); or in many cases, colors may be specified according to their common English names, such as gray, white, blue, etc.

    NoteRefer to the NiagaraAX Developer Guide section on HX Theming for more information on NSS file properties. Also, an Internet search for “html color codes” will result in many color code examples.

  2. After completing modifications, save the NSS file.

Build a.jar file for the theme module

This procedure describes building a .jar file for a new theme module so that the module can be deployed in Workbench.

  1. Open the Niagara Console and run the following build command, as shown in Figure 87:

    build -p [path to build.xml file] jar

    Figure 87. Enter command in Niagara Console to build .jar file


    Enter command in Niagara Console to build .jar file

  2. Confirm that the .jar file (for example: themeCitrus.jar) was created in the /modules folder.

  3. Exit and restart Workbench to load the .jar file.

Activate the new theme module

This procedure covers activating a new theme module.

  1. Select the new theme module in Tools->Options under the Active Theme drop-down, as shown in Figure 88.

    Figure 88. New theme is selectable in the Active Theme drop-down


    New theme is selectable in the Active Theme drop-down


  2. Click File->Close and restart Workbench, the new theme will be active, as shown in Figure 89.

    NoteTo save changes made in Workbench Options, such as a theme change, you must close/exit Workbench using File menu options or click the window’s close box (). Closing Workbench in the console will not cause those changes to be saved.

    Figure 89. New theme is applied to Workbench


    New theme is applied to Workbench