Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Colour strings

Colour strings are used to specify a pair of colours. The first in the pair is the “Day” colour, and the second in the pair is the “Night” colour.

The appropriate colour is used when the system is in either “Day” mode or “Night” mode.

Night mode is enabled if SDC detects that the vehicle headlights have been turned on but it can also be toggled with a touch action. If you do not want your night mode colours to be different to your day mode colours, then you can simply specify the same colour for both parts of the definition.

Colour strings can be specified in one of two ways:

Directly using 6 RGB values

To specify the colour set directly, you will specify a comma separated list which is in the form:

<day Red>,<day Green>,<day Blue>,<night Red>,<night Green>,<night Blue>

Example:

<gauge>
    <name>systemtime</name>
    <type>DynamicStringGauge</type>
    <x>512</x>
    <y>550</y>
    <fontsize>20</fontsize>
    <attribute>systime</attribute>
    <colours>255,255,255,128,128,128</colours>
    <visible>1</visible>
    <justification>centre</justification>
</gauge>

In the above example, the daytime colour would be white, and the night mode colour would be a mid-grey i.e. half way between black and white.

Indirectly using a definition

Example:

<gauge>
    <name>systemtime</name>
    <type>DynamicStringGauge</type>
    <x>512</x>
    <y>550</y>
    <fontsize>20</fontsize>
    <attribute>systime</attribute>
    <colours>greywhite</colours>
    <visible>1</visible>
    <justification>centre</justification>
</gauge>

Here the xml entry “greywhite” is used to reference a colour definition which is defined in the definitions section of the xml file. The definitions section appears at the end of the file, after the page list, and takes the following form:

<definitions>
    <cltok>0,255,0,0,255,0</cltok>
    <cltwarn>255,255,0,255,255,0</cltwarn>
    <cltbad>255,0,0,255,0,0</cltbad>
    <greywhite>255,255,255,128,128,128</greywhite>
</definitions>

There are other definitions possible than colours; see the definitions section for further information.

You may have noted that colours can also be specified using a <colour_script> attribute on certain controls. In scenarios where there is a <colour_script> defined that takes precedence, and the <colours> attribute will be ignored. For further details on <colour_script> see the section on Writing Scripts