Screen colours demo


A variety of different colours can be displayed on the screen using the additive colour method. As with a typical computer screen, combining the 3 "additive primary colours", red, green, and blue, in different combinations and at varying levels of intensity you can create a full range of colour images and shapes.

Zantiks units automatically recognise both the 'primary colours' (red, green, blue) and the 'secondary colours' (cyan, magneta, yellow & white) when used in your script (e.g., LIGHTS(LIGHT1,CYAN)).

When using the SETCOLOUR command, you can adjust the percentages of red, green, blue combined together to generate the specific colours you need for your experiments.

It is recommended that you experiment with the SETCOLOUR function to see the variety of colours you can create.

Top

Script explanation

This script demonstrates how you can create a range of colours on the built-in screen. You can play with the mix of red, green and blue to create the colour and shade that you want to display. 

ACTION MAIN
 
    SETLIGHT(LIGHT1,SQUARE,186,141,372)
    #SETLIGHT(LIGHT1,SQUARE,103,73,206)

The SETLIGHT command defines the shape, size and position of a light labelled LIGHT1. In this case, LIGHT1 is set as a square, its middle point is at 186,141 (x,y coordinates of the centre of the LT screen), and it will be 372 mm in size (full LT screen). The hashed out SETLIGHT command has the coordinates for the AD unit.

SETCOLOUR(10,1.0,0.75,0.75)

The SETCOLOUR function enables you to create a colour using red, green and blue and name this specific colour with a number, in this case '10'. Integer numbers only between 8 and 255 may be used for colour names

The first number in the brackets (10,1.0,0.75,0.75), is the 'number label' for the specific colour.

The next three numbers (10,1.0,0.75,0.75) set the levels of red, green and blue (in that order) in the colour you are creating. For full strength, use '1' and 0.75 will be 75% strength. If you used (1.0,1.0,1.0) you would use all three colours at 100% and create a white.

The colour mix for the above blend (1.0,0.75,0.75) is 100% red, and 75% green and 75% blue, which together creates a pale red.

LIGHTS(LIGHT1,10)
WAIT(1)

The LIGHTS function turns on LIGHT1 (as defined above in the SETLIGHT function) with the colour '10' - which was set in the above SETCOLOUR function.

SETCOLOUR(10,1.0,0.5,0.5)

This SETCOLOUR function creates a slightly darker version of the previous red and is composed of 100% red (1.0), 50% green (0.5), and 50% blue (0.5). It will be labelled '10', overwriting any previous colour (i.e., the previous SETCOLOUR function) that was labelled as '10'.

LIGHTS(LIGHT1,10)
WAIT(1)
LIGHTS(LIGHT1,RED)
WAIT(1)

The LIGHTS function turns on LIGHT1 with the colour '10', this will be the last colour that was set as '10'.

After a WAIT period of 1 second, LIGHT1 will turn on red.

SETCOLOUR(11,0.75,1.0,0.75)

The SETCOLOUR function above sets a colour which will be labelled '11', and will be composed of 75% red (0.75), 100% green (1.0), 75% blue (0.75) - to create a pale green.

SETCOLOUR(12,0.1,0.1,0.1) 
LIGHTS(LIGHT1,12) 
WAIT(1) 
 
SETCOLOUR(12,0.5,0.5,0.5) 
LIGHTS(LIGHT1,12) 
WAIT(1)

The SETCOLOUR function above sets a colour which will be labelled '12', and will be composed of 10% red (0.1), 10% green (0.1), 10% blue (0.1) - to create grey at 10% brightness.

The LIGHTS function turns on LIGHT1 with the colour '12'.

After a WAIT period of 1 second, the next SETCOLOUR function creates a slightly brighter version (50% brightness) of the previous grey and is composed of 50% red (0.5), 50% green (0.5), and 50% blue (0.5). It will be labelled '12', overwriting any previous colour that was labelled as '12'.

 SETCOLOUR(13,1.0,1.0,1.0) 
 LIGHTS(LIGHT1,13) 
 WAIT(1)

The SETCOLOUR function above sets a colour which will be labelled '13, and will be composed of 100% red (1.0), 100% green (1.0), 100% blue (1.0) - to create white.

The LIGHTS function turns on LIGHT1 with the colour '13'.

Top

Script download

To download the screen_colours demo script as a .zs file (file type Zantiks software reads), choose the Save File As option in the right-click dialogue box. Clicking on the script name hyperlink will open a read-only version of the script.

Script download: screen_colours_demo.zs