3k views
in Embedded Wizard Studio by
Our GUI application is running on a target that supports only 8bits per pixel - therefore we are using a Platform Package with the Index8 color format. The results with the default palette are not good enough - so we need to create a color palette that contains the colors of our GUI application. Since it is very hard to create the palette manually, I'm looking for some recommended way to create a color palette that fits to our GUI application.

1 Answer

0 votes
by

A color-lookup-table (CLUT) is a list of predefined colors. Many embedded platforms are using the 8 bit color format (so called Index8 color format) in order to save memory. In Index8 there can be defined up to 256 full color values (32bit, e. g. RGBA8888).

The challenging part lies in finding the optimal choice of colors for your specific user interface. The classical way to build a color lookup table is to compose a representative collage of UI elements in Adobe Photoshop (or any other suitable graphics application) to create a color palette. This is not easy especially if your application is using transparencies, which result in a huge variety mix colors.

Now, the good news is that Embedded Wizard supports automatic CLUT generation! Because it is a very common task, CLUT generation is made available as an integrated, highly sophisticated feature within the UI development tool. This makes it superfluous to manually generate color tables.

Part 1: Creating a color statistic

Creating an optimal color look up table is very easy: While you are developing your application or when you already finished it, you can navigate through your application in the Prototyper, allowing a color statistics module to collect information about the possible colors, not only as they appear in static values and pure bitmaps, but the mix color result of overlaid UI components.

  • Open the Embedded Wizard project for which you want to generate a color lookup table.
  • If not already existing, you will need to create a Win32 profile using RGBA8888 color format. In this case, navigate to the project Composer and add a new Profile object to it. Rename it to ‘Win32_RGBA8888’.
  • In Inspector you find the attribute PlatformPackage: enter or select the value ‘Tara.Win32.RGBA8888’. Set the attribute ScreenSize to the resolution of your target application.
  • Select the profile ‘Win32_RGBA8888’ in the profile selector combo box.

Once you have set up the profile, you can start collecting color statistics by browsing through your application or components in the Prototyper.

  • Open the application you want to collect color statistics within the Composer window. From the ‘Build’ menu select ‘Start prototyper with color statistics…’ instead of the item ‘Start prototyper’.

While you are navigating through your application or component a statistic about all used colors within the UI is generated and stored as a text file (ColorStatistic.txt) in the corresponding project directory.

The statistics file contains all used color values and the rate of their occurrences. The CLUT generator uses this information as input. The collection of color statistics is in a way a ‘learning phase’: the more UI situations covered and displayed, the better the quality of the statistics and therefore the quality of the resulting CLUT.

You can build up your color statistics progressively. If you want to generate a CLUT file in an early stage of developing an UI application, you can create a statistic file and incrementally update it in later Prototyper sessions:

Depending on if you want to start a new or improve your existing statistic, you are asked to resume or discard when starting the Prototyper with color statistics again.

Part 2: Creating an optimized CLUT

Your project directory contains now the statistics file ‘ColorStatistics.txt’ which contains hundreds or thousands of color values. This statistics file will now serve as the input for the CLUT generation.

  • Select the menu item ‘Generate CLUT file...’ from the 'Build' menu.

The Generate CLUT file dialog appears, presenting a number of options. You can reserve a desired number (up to 127) of entries, e. g. for external applications like Applets, sharing the CLUT with the UI application. Further more you can specify a filename for the file the CLUT will be stored in. If you need to manually specify certain colors for any reason, you can force these by adding them to a list of user defined colors.

The color quantization can be done in many ways. The following three common approaches for color reduction are supported:

  1. Majority - The majority algorithm prefers colors with a high frequency above colors of lower frequency of occurrences. Colors of lower frequency will be merged together.
  2. Diversity - The diversity strategy does not take the number of occurrences of a color into account, but tries to preserve the color variety.
  3. Popularity - The popularity approach is a combination of the above algorithms. Significantly different colors are only merged, when they are rarely occurring.

It is recommended to use the popularity algorithm for most situations. In some cases it nevertheless is wise to check the results of the other two approaches.

After you set up the parameters, press ‘Generate’ to start the CLUT generation. The result of the generation process is shown in the Log window.

Part 3: Assigning the CLUT file to your profile

To assign the generated CLUT file to a certain profile, use the ‘Clut’ attribute within the profile. Click the appropriate profile brick and enter the path and filename of the CLUT file into the field ‘Clut’.

For additional information, please have a look into 'Embedded Wizard User Manual'.

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...