Computer Science Canada

Colour selector/identifier

Author:  Drakain Zeil [ Wed Dec 22, 2004 4:24 pm ]
Post subject:  Colour selector/identifier

You can pick your nose, you can pick your friends, and now you can (easily) pick colours.

code:
View.Set ("graphics:320;340,position:center;center,nobuttonbar")

var c := 0
for cy : 1 .. 320 by 20
    for cx : 1 .. 320 by 20
        Draw.FillBox (cx, cy, cx + 20, cy + 20, c)
        c += 1
    end for
end for

var x, y, b : int
loop
    for cy : 0 .. 300 by 20
        for cx : 0 .. 300 by 20
            Mouse.Where (x, y, b)
            if (cx < x and x < cx + 20) and (cy < y and y < cy + 20) then
                c := (cx div 20) + ((cy div 20) * 16)
                %c := (ceil (x / 20) + (ceil (y / 20) * 16))
                Text.Locate (1, 1)
                colour (c)
                put "Sample text ", repeat ("-", maxcol - 17), " " ..
                colour (black)
                put c
            end if
        end for
    end for
end loop


It's a simple 30~ line program, displays all of the 256 colours you can use in turing, mouseover them for that colour to be output at the top. I think I was going to do somthing with the "b" variable... meh, it's nothing now.

Author:  cool dude [ Wed Dec 22, 2004 5:27 pm ]
Post subject: 

nice. try this

code:

var cont : string(1)
for c:0..255
drawfilloval (320,240,25,25,c)
locatexy (320,200)
put c
getch (cont)
end for


P.S. press any key to move on to the next colour


: