About the Schemes and Scheme Editor
What is a Scheme?
A scheme is a collection of colors that can be referenced by one or more widgets. Schemes can manipulate how widgets look by setting colors and transparency levels for various parts of the widget.
When a new widget is created, it is automatically assigned a default scheme. A user can change this to a custom scheme if so desired. The widget references its scheme during rendering.
Below is a list of scheme colors and a description of how it is typically used. Refer to the widget documentation to learn how schemes can be used to manage the widget’s appearance.
Scheme Colors
- Base: Default area fill
- Highlight: Light embossing
- Highlight Light: Very light embossing
- Shadow: Dark embossing
- Shadow Dark: Very dark embossing
- Foreground: A foreground color
- Foreground Inactive: Foreground color when inactive
- Foreground Disabled: Foreground color when disabled
- Background: A background color, usually to differentiate from Base
- Background Inactive: Background when inactive
- Background Disabled: Background when disabled
- Text: Text color
- Text Highlight: Text color background when highlighted
- Text Highlight Text: Text color when highlighted
- Text Inactive: Text color when inactive
- Text Disabled: Text color when disabled
How to Add a Scheme
A new Microchip Graphics Suite (MGS) Harmony Composer project has two schemes: the internal scheme and a default scheme called WhiteScheme.
The user is encouraged to define a scheme that adheres to their design goals. A design may have many schemes for each widget or it may share schemes across many widgets.
To add a new scheme to the list of schemes, click the + icon on the Schemes pane.
To modify the scheme property, choose the scheme from the scheme pane, then select the Scheme Editor tab on the bottom right side of the MGS Harmony Composer. You can modify the Name, Color Mode, and the colors of the color table.
To change the color or to set a transparency level to any color of the color table, click on the particular color to launch the Color Editor. Set the color by entering individual RGB (and alpha to set transparency), or selecting the color from the color palette or color wheel. Click OK.
How to Set the Color Table
The color table in a scheme has all the colors as described in the "Scheme Colors" section. Each color affects the widget differently. A Scheme Helper is available for each widget to understand the impact of the color table on it. To access the scheme helper for a widget, follow the steps shown.
Figure 4: Accessing Scheme Helper shows how to access scheme helper for a widget.
The Scheme helper shows how the different colors of the color table are used to render different parts of a widget. Figure 4 shows the scheme helper for a button widget.
How to Apply a Scheme to a Widget
As an example of how to apply a custom scheme to a widget, we will see how to apply a red scheme to a button widget. For details on how the color table of a scheme affects each widget, refer to the particular widget guide.
The scheme field is part of the base widget properties. This means every widget has a scheme field.
Figure 5: Scheme Property in Button Widget Properties shows the properties of a button widget in the Object Editor window. The Scheme field is associated with the default internal scheme.
To apply a red scheme to the button widget, follow the steps.
Choose the desired scheme, in this case RedScheme, and click OK.
Figure 6: Applying a scheme to a button widget shows how the button widget is set to RedScheme.
Applying Scheme Using API
The widget scheme may be changed in run time from the user application. For example, the text on buttons may be changed to show active/inactive states. The setScheme() API can be used for this purpose. For example:
Similarly, the scheme can be set/changed for all other widgets.