Posted: Mon Apr 25, 2005 12:33 pm Post subject: colour guide program
Here is a program that gives the number and shows the colour of all 256 Turing colours.
%Nick
%April, 22/2005
%Colour Guide
var col := 0
var do : string (1)
loop
put col
Draw.FillBox (100, 100, 300, 300, col)
getch (do)
if do = (KEY_RIGHT_ARROW) then
col := col + 1
cls
elsif do = (KEY_LEFT_ARROW) then
col := col - 1
cls
end if
end loop
Sponsor Sponsor
jamonathin
Posted: Mon Apr 25, 2005 1:31 pm Post subject: (No subject)
What if i wanna know what color 254 is? don't wanna have to wait that long. Try and make a program that's much faster, and displays all colors and numbers. There's a few of these types of programs on this site as well.
Shyfire
Posted: Tue Apr 26, 2005 1:23 pm Post subject: (No subject)
you could make it faster
dann_west
Posted: Thu Apr 28, 2005 1:32 pm Post subject: Re: colour guide program
Pretty Good Nick but it is a slow program.You show make it so you type in a # and it shows the colour.
DarkAng
Posted: Thu May 12, 2005 3:30 pm Post subject: colour
here is one that i made that will be faster and lets u choose a colour
code:
%Colour display program.
var window : int := Window.Open ("graphics:max;max")
var typeChoice, colourChoice, backgroundChoice : int
setscreen ("buttonbar")
%Two different modes.
procedure choice (number : int)
%Displays colours one at a time.
if number = 1 then
for colours : 1 .. 255
colourback (colours)
put colours, " ", colours, " ", colours, " ", colours, " ", colours, " ", colours, " ", colours, " ", colours
delay (50)
end for
%Displays the chosen colour.
else
put "Enter the number of the colour you wish to view."
loop
get backgroundChoice
colourback (backgroundChoice)
cls
end loop
end if
end choice
%Asks what how the user wants the colours displayed.
put "Would you like to see the colours one by one, or would you like to pick a number?"
put "1 : show colours one at a time"
put "2 : pick number and display colour"
get typeChoice
choice (typeChoice)
neufelni
Posted: Wed May 25, 2005 11:05 am Post subject: (No subject)
A few problems with DarkAng's program. First of all, if you choose to go through the colours one at a time, it goes way too fast to view the colours and the number, and you can't go back up, so you can't view the top colours again unless you restart the program. Secondly, because the numbers are in black you can't see what number the darker colours are.
DarkAng
Posted: Wed May 25, 2005 3:37 pm Post subject: (No subject)
Nick wrote:
A few problems with DarkAng's program. First of all, if you choose to go through the colours one at a time, it goes way too fast to view the colours and the number, and you can't go back up, so you can't view the top colours again unless you restart the program. Secondly, because the numbers are in black you can't see what number the darker colours are.
yes thats true but you can pause the program thats what the
setscreen ("buttonbar") is for.
+ if you want to slow it down you can just increase the delay near the beginning of the program. i purposely made it faster so i could just scan through the colours
Flikerator
Posted: Thu May 26, 2005 1:20 pm Post subject: (No subject)
For the second option you may want to error trap it so that if a number > 255 is entered then it doesn't exit the program.
Sponsor Sponsor
neufelni
Posted: Thu May 26, 2005 2:03 pm Post subject: (No subject)
I made a better colour guide program so that you can see the number and you can easily view all the colours. Here it is :
code:
var number, choose : int
put "1. Go through all the colours."
put "2. Choose a number to view the colour."
get choose
cls
if choose = 1 then
View.Set ("graphics:800;4600")
for c : 0 .. 255
colourback (c)
colour (black)
put c, " " ..
colour (white)
put c
end for
elsif choose = 2 then
View.Set ("graphics:600;400")
loop
colour (black)
put "Enter a number to view the colour."
colour (white)
put "Enter a number to view the colour."
get number
colourback (number)
cls
end loop
end if
the_binary_soul
Posted: Fri May 27, 2005 9:36 am Post subject: (No subject)
here is my version I did last year. Probably could be made shorter... meh
(did this last year I believe)
code:
setscreen ("graphics")
var KEY : string (1)
var SEARCH : int
var POINT : int
var i : int := 0
proc START
cls
put " enter colour number to start scrolling from, press enter to return"
color (55)
put " use arrow keys to scroll up or down, press ESC to exit"
get POINT
i := POINT
end START
proc DISPLAY
loop
if i = -1 then
i := 255
elsif i > 255 then
i := 0
end if
color (i)
Draw.FillBox (1, 400, 500, 300, i)
put "colour "
color (255)
put i
getch (KEY)
if ord (KEY) = 10 then
START
elsif ord (KEY) = 200 then
i += 1
elsif ord (KEY) = 208 then
i -= 1
end if
cls
if i = 255 then
i := 0
end if
exit when ord (KEY) = 27
end loop
end DISPLAY
START
DISPLAY
RaPsCaLLioN
Posted: Fri May 27, 2005 10:12 am Post subject: (No subject)
Here's my version.
code:
var iWindow : int := Window.Open ("graphics:svga, noecho, nocursor")
for i : 0 .. 86
drawfillbox (i * 6, 1, i * 6 + 6, 100, i)
end for
for i : 0 .. 86
drawfillbox (i * 6, 105, i * 6 + 6, 205, i + 86)
end for
for i : 0 .. 86
drawfillbox (i * 6, 210, i * 6 + 6, 310, i + 86 + 83)
end for
var x, y, b : int
loop
mousewhere (x, y, b)
put "Color Default ID Number: ", whatdotcolour (x, y)
locate (1, 1)
exit when buttonmoved ("down")
end loop
Window.Close (iWindow)
the_binary_soul
Posted: Fri May 27, 2005 10:27 am Post subject: (No subject)
damn, I'm beat.... only. How come black at the end shows up as 7. Should it not be 255?
RaPsCaLLioN
Posted: Fri May 27, 2005 1:33 pm Post subject: (No subject)
meh... black is black
jamonathin
Posted: Fri May 27, 2005 4:54 pm Post subject: (No subject)
Guys, keep it simple. A color-guide program is something you can make fast, on the spot, not have to look it up and load it.
try this.
code:
for i: 1 .. maxcolor
color(i)
put i, " " ..
end for
And for better color results just put
code:
colorback(black)
cls
before the proggy.
Cervantes
Posted: Fri May 27, 2005 5:53 pm Post subject: (No subject)
Except, it's a lot harder to use that. Each colour only appears as text and doesn't really allow you to see much about that colour. The light colours barely show up against white, and the dark colours barely show up against black.
Also, there's no reason to not make this more complex. I agree, there are much better complex programs to spend time on. But that should not deter doing this; it should just bump it down the to do list.
I prefer:
code:
View.Set ("graphics:max;4120")
for i : 0 .. 255
colourback (i)
put i
end for
the_binary_soul wrote:
How come black at the end shows up as 7. Should it not be 255?
Original Turing had just a few colours (prolly ~1-8 ). Then they added more. The first few colours are based on maxing out RGB values. So, you've got Red, where:
R:1.0, G:0.0, B:0.0
And somewhere Purple:
R:1.0, G:0.0, B:1.0
and so on and so forth. This was fine for the limited graphics you could get in Classic Turing.
Once the switch to OOT was made, 256 colours came into being. This started at around colour 17 or so, and was based on adding fractions to RGB instead of wholes so as to get a lot more colours.
This meant that at some point, you'd get R:1.0, G:0.0, B:0.0 and such. Thus the duplication.
Of course, they could've been clever and have reset the entire scheme so that it made sense...and they could've supported more than just freggin' 256 colours...but well, it's Holt and we don't question them (much).
Now, of course, RGB has been implemented in a very limited fashion. Sure you can make new colours, but try load in a .jpg and read the colours at any point using whatdotcolour(). You'll only ever get values that read in the 0-255 range. Why? For some odd reason, OOT cannot take a pixel and return its true specific RGB values...only the ones it wants to believe they are...[sigh].
Anyhow, this can pose quite a problem for you if you're working w/ more than ~16 colours, and using whatdotcolour() as has just been demonstrated.