RGB Colour Co by 00bk18th Mar 2005 13:10
|
---|
Summary Find your perfect colour with ease and instantly see the colour in the CLS RGB command! Description Find your perfect colour with ease and instantly see the colour in the CLS RGB command! By using just six keys, find your perfect colour, and view how you would input it into your work. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com set window size 600, 500 set window title "RGB Colour Co-ordinator" set window position screen width() / 2, screen height() / 2 remstart ############################## #RGB Colour Co-ordinator # #Author: Ben Kahan # #Version: 2.0 # #Comments: # #Please use this for any of # #your work for as much as you# #like! # ############################## remend `set the starting background colour - by default its black (0,0,0) but this is just so `you know: cls rgb(0,0,0) `start the loop: do `make sure that if any of the colours reach 0 then it displays 0 on the screen - there `were problems with it just displaying nothing: if rvalue$ = "" then rvalue$ = "0" if gvalue$ = "" then gvalue$ = "0" if bvalue$ = "" then bvalue$ = "0" `make sure that the colours can't go above 255 and below 0: if val(rvalue$) < 0 then rvalue$ = "0" if val(rvalue$) > 255 then rvalue$ = "255" if val(gvalue$) < 0 then gvalue$ = "0" if val(gvalue$) > 255 then gvalue$ = "255" if val(bvalue$) < 0 then bvalue$ = "0" if val(bvalue$) > 255 then bvalue$ = "255" `assign different keys for different colours: if inkey$() = "q" then rvalue$ = str$(val(rvalue$) + 1) if inkey$() = "a" then rvalue$ = str$(val(rvalue$) - 1) if inkey$() = "w" then gvalue$ = str$(val(gvalue$) + 1) if inkey$() = "s" then gvalue$ = str$(val(gvalue$) - 1) if inkey$() = "e" then bvalue$ = str$(val(bvalue$) + 1) if inkey$() = "d" then bvalue$ = str$(val(bvalue$) - 1) `display the colour on the background: cls rgb(val(rvalue$),val(gvalue$),val(bvalue$)) `display information: print "Use 'q', 'w' and 'e' to make the values of red, green and blue higher." print "Use 'a', 's' and 'd' to make the values of red, green and blue lower." print "Current colours:" print "Red: " + rvalue$ print "Green: " + gvalue$ print "Blue: " + bvalue$ print "In RGB form (what you write in DBPro for this colour):" print "CLS RGB(" + rvalue$ + "," + gvalue$ + "," + bvalue$ + ")" `end the loop: loop |