Computer Science Canada

Searching and Comparing Colours

Author:  scholarlytutor [ Tue Nov 02, 2021 8:06 am ]
Post subject:  Searching and Comparing Colours

I have a simple tutorial for today, and some files to go with it. Let's say you're fairly new to Turing and you're into graphics (like me). You start with using named colour codes like blue, red, green and so on (which correspond to colour codes 0 to 15), but you soon realize that there are unnamed colour codes that range from 16 to 255. Maybe you want to find orange. Well, what's an easy way to find it? Make your own custom programs for searching and comparing colours!

Here are two very simple programs I made which do just that. The first one simply loops through each colour from 16 to 255 every third of a second. When you come across one you like, click 'Pause' to pause the program. You can also click 'Resume' to keep searching, but if you want to start from the beginning, just press any key to end the program.

The second program divides the screen in 4 portions. Each portion has a drawfill command. Enter the colour codes you want to compare into the 000 slots in my program and you can take your time deciding exactly which colour you like best.

Finally, once you found a code you like, save it as a constant. You may even want to make a separate file that stores colour codes you like. So for Orange:

const Orange := 42

Finally, for those who feel limited by the 256 colours, there is an RGB module which allows you to use more. Take a look in the Turing reference/documentation for more information.

Of course, there are better programs you can make than these, as well as other colour tutorials you can read on Compsci.ca, but these programs are easy to understand if you're still fairly new to programming. Feel free to add other tips and examples in your comments.

That's all for today. Happy Turing programming!

Author:  TheTuringTest [ Tue Nov 16, 2021 10:20 am ]
Post subject:  RE:Searching and Comparing Colours

I don't even know how this all works yet but this looks useful! I'm excited to make some colourful computer programs.


: