162 THE OFFICIAL RASPBERRY PI BEGINNER'S GUIDE
5 Figure 7-8: Changing the colour of the message and backgroundIf you want to use friendly names instead of RGB values to set your colours, you’ll need to
create variables. Above your sense.show_message() line, add the following:yellow = ( 255 , 255 , 0 )
blue = ( 0 , 0 , 255 )Go back to your sense.show_message() line and edit it so it reads:sense.show_message("Hello, World!", text_colour=(yellow), back_
colour=(blue), scroll_speed=( 0. 05 ))Click the Run icon again, and you’ll see nothing has changed: your message is still in yellow
on a blue background. This time, though, you’ve used the variable names to make your code
more readable: instead of a string of numbers, the code explains what colour it’s setting. You
can define as many colours as you like: try adding a variable called ‘red’ with the values 255, 0,
and 0; a variable called ‘white’ with the values 255, 255, 255; and a variable called ‘black’ with
the values 0, 0, and 0.
As well as being able to scroll full messages, you can display individual letters. Delete your
sense.show_message() line altogether, and type the following in its place:sense.show_letter("Z")