Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 The Many Colours of Turing
Index -> Programming, Turing -> Turing Tutorials
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Parzival




PostPosted: Tue Mar 26, 2013 7:11 pm   Post subject: The Many Colours of Turing

Now for anyone trying to get the hang of colours, there are two ways you can change the colour of something.. either by stating the name of the colour (word) or by typing in the colour's assigned value (nuumber).

Some examples of what it would look like if you were to use the colour's name:

colour(green)

colour(brightgreen)

colour(blue)


*NOTE: Not all colours are supported. Which is why it can be better to use the values.

Some examples of what it would look like if you were to use the colour's value:

colour(13)

colour(57)

colour(89)


As you can probably see, it's impossible to tell what colour the numbers are assigned to, unless of course you have a chart or have memorized each one.
So to make it a bit easier, I have quickly written a program that prints out all of the colours as well as their values. The comments do a fairly good job at
explaining what the program does, assuming you have some knowledge of the language. Just copy the following text into Turing (I use 4.1.1) and hit Run to see
all of the colours appear before you along with their values.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Turing:
% If you want to make this program 'Windowed Fullscreen', change the line below this to ' setscreen("graphics:max;max") '
setscreen("graphics,position:center;bottom")
setscreen("nobuttonbar") %removes the toolbar with "Pause, Close, Print, Save, Paste" on it. Either delete or comment out this line if you want the bar.
setscreen("title: Colours in Turing") %What the program says in the top bar, feel free to change it to whatever you like.

% Sets the colours as well as the numbers. There are only 255 colours in Turing, so we use the range 1 to 255
for a : 1 .. 255

    % Changes the text colour so it is easier to read what the number is.
    % If you want to add any more, just add this to the first 'if' line:
    %
    %                  " a=x ".
    %                        ^
    % *Replace the 'x' with the number you want to change the colour of*
    if a=31 or a=14 or a=68 or a=44 or a=90 or a=91 or a=92 or a= 93 or a=94 or a=95 or a=96
   
            then
           
        colour (1) % The colour that the text changes to.. in this case, Black(1)
       
    else
           
        colour (31)% If 'a' does not equal one of those numbers, the text stays White(31)
    end if
   
    colourback (a) % Makes the background colour, one of the colours in the range 1..255
    put a, " " ..      % Prints it all out on the screen.. if you want to be able to see more of the colours, just make the " " farther apart.
                          % This may interfere with the layout but the colours and numbers will still be in order. 
end for

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I would save this program somewhere on your computer so that it's conveniently there at your disposal. I'm sorry if this wasn't as in-depth as you expected it to be. I more or less just created this 'Tutorial" to give you the program and tell you a little bit about colours. Thank you.

*NOTE: You can't just put "colour(blue)" or "colour(45)" into Turing alone. It must be assigned to either text or an object, otherwise it will not appear.

*NOTE: Also take note that I am Canadian, I spell colour with a 'u'. Turing will accept either "colour" or "color"


Smile
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Tue Mar 26, 2013 7:18 pm   Post subject: RE:The Many Colours of Turing

You should look into the rgb module. color(x) is limited to 128 colors (I think. It might be 256). The rgb module allows far more colors.
Cancer Sol




PostPosted: Tue Mar 26, 2013 7:31 pm   Post subject: Re: The Many Colours of Turing

Insectoid, you're a mod right? Someone (a mod) could maybe edit it and use the turing syntax thingy to make it look more beautiful Very Happy

Just in case you didn't know (or anyone who sees this and doesn't know), you can't compile your turing programs on version 4.1.1, you'll have to download 4.1 instead.
I'm not telling you to compile this program though, it wouldn't be right for what you're trying to show Razz

Nice tutorial though, and welcome to the CompSci forums!

P.s. next time you post your codes, use this:
code:

[syntax="turing"]
your code here
[/syntax]

At least, that's what I think it is xD
It'll allow indents for your codes and it'll add the turing syntax highlights.
Insectoid




PostPosted: Tue Mar 26, 2013 7:33 pm   Post subject: RE:The Many Colours of Turing

Yeah, I'm not a mod. Dunno why, I mean, I should be right now, right?
Cancer Sol




PostPosted: Tue Mar 26, 2013 8:08 pm   Post subject: Re: RE:The Many Colours of Turing

Insectoid @ 3/26/2013, 7:33 pm wrote:
Yeah, I'm not a mod. Dunno why, I mean, I should be right now, right?

Yeah Very Happy
You've helped the community a lot, and you're an active member.
Maybe you should talk to Dan about being a mod Smile
I would PM Dan or Tony to be your voucher, but I kinda spammed Dan a bit... if three PM's count xD
Insectoid




PostPosted: Tue Mar 26, 2013 8:10 pm   Post subject: RE:The Many Colours of Turing

I talk to Dan all the time. If I'm not a mod, there's a reason for it.
Dan




PostPosted: Wed Mar 27, 2013 1:58 am   Post subject: RE:The Many Colours of Turing

I added a code tag to your post Parzival (as requested by Cancer Sol).

There is no reason in particular Insectoid is not a mod other then the fact that we don't relay need any more mods right now. However, if you want Insectoid I can give you a custom title/rank since you have at least earned that. PM me if you want one.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Cancer Sol




PostPosted: Thu Mar 28, 2013 4:26 pm   Post subject: Re: RE:The Many Colours of Turing

Dan @ 3/27/2013, 1:58 am wrote:
I added a code tag to your post Parzival (as requested by Cancer Sol).

There is no reason in particular Insectoid is not a mod other then the fact that we don't relay need any more mods right now. However, if you want Insectoid I can give you a custom title/rank since you have at least earned that. PM me if you want one.


Thanks Dan, so many people aren't using them. I just wish they would read the sticky Sad
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: