5.1.2 Creating a Custom Theme

If the supplied System Themes do not suit your design requirements, you can create your own Theme.

Start by creating a Theme object. This will automatically generate some start code for you based on the system theme 2015Gray.

The first thing you may want to change is the BaseTheme associated with your theme. As for a Web Page (#PRIM_WEB) the BaseTheme default value is set as *null, indicating that the system theme 2015Gray will be applied. You can select a different System Theme as the BaseTheme. In the following example the BaseTheme is 2015DeepOrange.

Begin_Com Role(*EXTENDS #PRIM_THM) Style(#ThemeStyle) Basetheme(2015DeepOrange)

 

Define_Com Class(#PRIM_VS.SolidBrush) Name(#AlmostBlack) Color(34:34:34)

 

Define_Com Class(#PRIM_VS.Style) Name(#ThemeStyle) Facename('Tahoma, Geneva, San-serif') Fontsize(12) Fontunits(Pixel) Foregroundbrush(#AlmostBlack)

Also note in this example that a style, ThemeStyle, has been applied to the entire theme object. This style is used to defined the base font properties.

The Facename property can be a single font or can be used to specify a font family.

Text color can be nominated using the Textcolor or Solidbrush properties. A Textcolor is restricted to be ing an RGB color value or a LANSA specified color name. Alternately you can define a SolidBrush (which can be re-used elsewhere in the theme) to set the Foregroundbrush color.

Note - Pixels and points are fixed, whereas percentage is a relative unit size.

Themes are compiled objects so any changes applied to the theme will be automatically applied after the theme is recompiled.

To see the User Theme in the designer return to the IDE settings and select to use your new Theme as the Design Theme.

For more information on Themes, refer to Themes in What the Application will look like in the Visual LANSA Developer's Guide.