For devices with colour display, the following possibilities are supported by the Terminal Programming Tool:
For details on which terminals are avaliable with colour display, and which colour model is supported by a certain device, look at the 'Feature Matrix'.
This document describes some (but not all) possibilities of colour usage
in the programmable terminals by MKT Systemtechnik.
< to be completed... >
See also
Since November 2007, in devices with certain colour displays, colour values can be specified in the parameter list of some graphic commands. If possible, only the following standard colour values should be used :
Old Colour value | Token (for display interpreter commands) | Script language | Colour |
0 | black | clBlack | black |
1 | blue | clBlue | blue |
2 | green | clGreen | green |
3 | cyan | clCyan | cyan |
4 | red | clRed | red |
5 | magenta | clMagenta | violet |
6 | yellow | clYellow | yellow |
7 | white | clWhite | white |
8 | RGB(64,64,64) | darkgray | |
9 | RGB(127,127,255) | lightblue | |
10 | RGB(127,255,127) | lightgreen | |
11 | RGB(192,192,255) | lightcyan | |
12 | ? | ||
13 | ? | ||
14 | ? | ||
15 | RGB(192,192,192) | lightgray | |
Negative colour values have a special meaning in the programming tool:
Colour value | Meaning |
-1 | use the default value defined for the current page, which may depend on the day/night-flag. |
-2 | transparency |
Terminals with TFT colour display support at least 256 different colours (see feature matrix). In those cases, colour can be expressed as RGB mixtures as explained here.
Additionally, in the programming tool and certain terminals with TFT display, colours can be defined as an RGB mixture - see next chapter.
To open the following colour selection dialog, double-click into one of the colour edit fields in the programming tool (for example, the input fields for the foreground- and background colour on the display page definition tab) .
After selecting a colour with this dialog, the R-G-B-mixture will be converted into a text string, and displayed in the edit field as follows:
#<Red component><Green component><Blue component>
Each colour component is encoded as a single digit between zero and seven
(the result is actually an 8-bit octal number).
Examples:
#000 = Black
#777 = White
#700 = Red (max. saturation)
#070 = Green (max. saturation)
#007 = Blue (max. saturation)
To change the foreground- or background colour of characters on a colour TFT screen during runtime (for example, MKT-View II), the following interpreter function can be used:
All three colour components are scaled from 0 (zero, minimum) to 255 (maximum), regardless of the colour model internally used in the LCD controller.
To modify the foreground- or background colour of a certain display element during runtime (not at design time), use the interpreter's "disp" command, which allows accessing any element on the current display page.
disp.Title.bc=rgb(127,255,255)
: REM set background colour of
element "Title" to light cyan
But remember, since this function is not available on all targets (especially not on "older" devices), use the standard colours wherever possible.
With different default colours, you can realize a simple 'Day/Night' switching option in your application.
To do that, define suitable fore- and background colours in the Display Page Header, for example:
A display page with this colour scheme would look like this during the day...
... and it would look like this during the night:
To switch between day and nicht, switch the day/nicht flag ("night
") at runtime
via interpreter command or script - more on that later.
To flip between 'day' and 'night' when designing a display page in the programming tool (simulator),
select (in the tool's main menu)
Options ... Toggle Day/Night
or (alternatively) on the 'Display Page Header' / 'Page Properties' panel shown above,
click on the table header 'Day' (Tag) / 'Nacht' (Night). This will internally set the night
-flag
to 1 (TRUE, night) or 0 (FALSE, not night but day), actually the same flag that can be controlled via interpreter
or script, too. The current state of the 'night' flag can also be checked in the watch-window.
When creating display pages suitable for day/night switching, you should not use fixed back- and foreground
colours for most display lines, but keep those individual colours at '-1' (which means "use the colour
from the 'display page header', i.e. the default colours for this page).
In the screenshot shown above, the text "MKT-View II" always has the same colour (regardless of the 'night'-flag),
because this display line has a fixed colour (here: green):
Most other display elements on this page either use the 'default' background colour (-1), or a transparent background (pseudo colour number "-2"):
There are many ways to switch between 'day' and 'night' colours automatically.
You can access the 'night'-flag via display interpreter (old method, without scripts),
or (preferred) control it vis script ( display.night ).
In any case, setting the 'night' flag means (you guessed it) "use the 'NIGHT' colours",
and clearing it means "use the 'DAY' colours".
Here are a few examples how the 'night' flag could be controlled in your application:
Event | Reaction |
always | night=ExternalDayNightFlag : REM day/night signal received from CAN |
The signal "ExternalDayNightFlag" must have been imported from a CAN database (DBC), and connected to a display variable. If necessary, the external signal can be inverted (if the CAN signal is set during daylight, and cleared at night).
Event | Reaction |
always | night = (sys.alight-6*night)<50 : REM day/night with hysteresis |
Event | Reaction |
kb0 | night = ! night : REM toggle day/night on function key |
Method B: Use F1 to switch to 'night', and F2 to switch to 'day' design:
Event | Reaction |
kb0 | night = 1 : REM select NIGHT-design |
kb1 | night = 0 : REM select DAY-design |
Method C (for devices with a touchscreen) : Program a graphic button, which toggles the "night"-flag whenever you press it (same reaction as in method 'A').
For certain elements like Buttons, two different background colours can be defined. The background of the button will be filled with a colour gradient from the first to the second background colour.
To produce a gradient fill anywhere else (without a graphic button), use the graphic command "gf" (gradient fill) .
Users of colour displays sometimes face the problem that many pages in their applications will (sooner or later) use a dreadful mix of different colours, especially when display pages have been 'recycled' from other projects, or the old 'gallery pages'.
In those cases the colours used on the display pages can quickly be modified, by replacing the colours defined in individual page's "page headers" with the so-called 'harmonized' colours. Use the following procedure to achieve this:
Last modified: 2016-10-14, W.B.