Setting the Project Color Mode
Introduction
Color Mode refers to the way colors are represented and managed in display systems, particularly in microcontroller-based applications that involve Graphical User Interfaces (GUIs) or displays. In Microchip Graphics Suite (MGS) Harmony, the project Color Mode determines the number of bits used for each pixel (bpp or bits-per-pixel) and the range of colors available in the GUI.
The higher the bit-depth, the more colors can be represented, resulting in more detailed and accurate color representation. However, higher bit-depth requires more memory and processing power to render. Selecting the appropriate Color Mode for your UI design and target hardware helps optimize the GUI for performance and memory consumption.
Supported Color Modes
MGS Harmony supports the following color modes:
Color Mode | Bits-per-pixel | Description |
MONO | 1 bit | Monochrome |
GS_8 | 8 bits | Grayscale |
RGB_332 | 8 bits | 3 bits RED, 3 bits GREEN, 2 bits BLUE |
RGB_565 | 16 bits | 5 bits RED, 6 bits GREEN, 5 bits BLUE |
RGB_5551 | 16 bits | 5 bits RED, 5 bits GREEN, 5 bits BLUE, 1 bit ALPHA |
RGB_888 | 24 bits | 8 bits RED, 8 bits GREEN, 8 bits BLUE |
RGBA_8888 | 32 bits | 8 bits RED, 8 bits GREEN, 8 bits BLUE, 8 bits ALPHA |
ARGB_8888 | 32 bits | 8 bits ALPHA, 8 bits RED, 8 bits GREEN, 8 bits BLUE |
Setting the Color Mode
For New Projects
The default Color Mode is selected when creating a new project in MGS Composer. This is the color mode used for new layers created in the design.
For Existing Projects
To change the Default Color Mode of existing MGS Composer projects, go to Project > Project Settings > Renderer > Default Color Mode.
To set the layer color mode, select each layer in the design and set the Color Mode property to the new color mode.
Note that MGS Composer allows different color modes for each layer. This is not commonly used and is mainly reserved for use in configurations where absolutely needed (e.g., memory or bandwidth constraints in multi-layer designs).
Image Assets Color Mode
The color mode for image assets is independent of the project color mode.
If the image asset color mode is different from the color mode of the layer where the image is being rendered, the graphics library will convert the image color to match the project color mode before rendering. This color conversion step adds processing overhead and may reduce performance.
As a general guideline, we recommend that the image color mode be set to match the project color mode. Refer to the "Using Images in Microchip Graphics Suite (MGS)" page for more information.
Color Schemes Color Mode
The color mode setting for color schemes is independent of the project color mode. MGS Composer generates a table of colors for each supported color mode so the values are the same regardless of the project color mode.
The color mode setting sets the way the color values are set and presented in the Color Scheme editor window, and it does not need to be changed when changing project color modes.
Display Driver Color Mode
The display controller color mode is separately configured through the display driver. For MGS Harmony, the display controller color mode must be set in the display driver component in MCC Harmony for the target platform.