; GetColor Example ; ---------------- Graphics 640,480,0,2 SetBuffer BackBuffer() ; A colourful photo to pick colours from logo=LoadImage("media/b3dlogo.jpg") While Not KeyDown(1) Cls DrawImage logo,120,140 ; GetColor grabs the colour of the pixel under the mouse... GetColor MouseX(),MouseY() ; ...and ColorRed/Green/Blue read the picked colour back r=ColorRed() g=ColorGreen() b=ColorBlue() ; Show the picked colour as a swatch next to the pointer Color r,g,b Rect MouseX()+12,MouseY()+12,24,24,1 Color 255,255,255 Rect MouseX()+11,MouseY()+11,26,26,0 Text 0,0,"Move the mouse over the photo to pick colours Esc: exit" Text 0,20,"GetColor "+MouseX()+","+MouseY()+" -> RGB "+r+","+g+","+b Flip Wend End