Ok, it looks like SET SPRITE DIFFUSE easily takes care of the color palette. Here's a version with color selection using the center mouse button:
gosub Init
opacity#=12.5:SpriteLimit=10000:load image "brush-white.png",1,1:sprite 1,0,0,1:hide sprite 1:offset sprite 1,sprite width(1)/2,sprite height(1)/2
set sprite 1,1,1:set sprite alpha 1,opacity#*2.55:set sprite priority 1,1:dim UndoStart(100000):dim UndoEnd(100000):count=1:center text 320,240,"(LMB-Draw) (RMB-Erase) (CMB-Select Color) (Z-Undo)":while mouseclick()=0:endwhile:backdrop on:color backdrop 0
gosub DoMenu
gosub BoxGraphics
MainLoop:
do
Moved=0:if omx<>mousex() or omy<>mousey() then Moved=1
if mouseclick()>0 and timer()>PaintTimer# and Moved=1
inc count:if count>SpriteLimit then count=2
if sprite exist(count) then delete sprite count
sprite count,mousex()-(image width(1)/2),mousey()-(image height(1)/2),1:if mouseclick()=2 then set sprite diffuse count,0,0,0 else set sprite diffuse count,Rcp,Gcp,Bcp
set sprite alpha count,(opacity#*2.55):PaintTimer#=timer()+50:if Painting=0 then Painting=1:inc undocount:UndoStart(undocount)=count
ENDIF
if Painting=1 and mouseclick()=0 then Painting=0:UndoEnd(undocount)=count
paste sprite 1,mousex(),mousey():omx=mousex():omy=mousey():if lower$(inkey$())="z" then gosub undo
if mouseclick()=4 then goto ColorFinder
LOOP
Undo:
if undocount>0
for und=UndoStart(undocount) to UndoEnd(undocount)
delete sprite und
NEXT
count=UndoStart(undocount)-1:dec undocount
ENDIF:while inkey$()<>"":ENDWHILE:return
ColorFinder:
while mouseclick()=4:ENDWHILE
for h=1 to SpriteLimit
if sprite exist(h) then hide sprite h
NEXT
DO
gosub DoMenu
gosub BoxGraphics
if mouseclick()=4
while mouseclick()=4:ENDWHILE
for s=1 to SpriteLimit
if sprite exist(s) then show sprite s
NEXT
set sprite diffuse 1,Rcp,Gcp,Bcp
goto MainLoop
ENDIF
LOOP
Init:
Gray=rgb(128,128,128)
DkGray=rgb(28,28,28)
Black=rgb(0,0,0)
Red=rgb(255,0,0)
Green=rgb(0,255,0)
Blue=rgb(0,0,255)
sw#=screen width()
sh#=screen height()
box 0,0,sw#*.8,sh#*.4,DkGray,Gray,DkGray,Gray
box 20,30,275,33,DkGray,DkGray,Black,Black
box 20,90,275,93,DkGray,DkGray,Black,Black
box 20,150,275,153,DkGray,DkGray,Black,Black
box 20,28,275,30,Black,Black,Red,Red
box 20,88,275,90,Black,Black,Green,Green
box 20,148,275,150,Black,Black,Blue,Blue
ColorPanel=2:get image ColorPanel,0,0,sw#*.8,sh#*.4
Rcp=128:Gcp=128:Bcp=128:cls
return
DoMenu:
ink Gray,0:MenuTouch=-1
if mousex()>19 and mousex()<276 then MenuTouch=0
if mousey()>=15 and mousey()<=45 then inc MenuTouch,10
if mousey()>=75 and mousey()<=105 then inc MenuTouch,20
if mousey()>=135 and mousey()<=165 then inc MenuTouch,30
if mouseclick()=1
if MenuTouch=10 then Rcp=mousex()-20
if MenuTouch=20 then Gcp=mousex()-20
if MenuTouch=30 then Bcp=mousex()-20
ENDIF
return
BoxGraphics:
paste image ColorPanel,0,0
center text 20+Rcp,25,"|"
center text 20+Gcp,85,"|"
center text 20+Bcp,145,"|"
ink Black,0:set cursor 281,21:print Rcp:ink rgb(Rcp,0,0),0:set cursor 280,20:print Rcp
ink Black,0:set cursor 281,81:print Gcp:ink rgb(0,Gcp,0),0:set cursor 280,80:print Gcp
ink Black,0:set cursor 281,141:print Bcp:ink rgb(0,0,Bcp),0:set cursor 280,140:print Bcp
Ucolor=rgb(Rcp,Gcp,Bcp)
box sw#*.5,sh#*.03,sw#*.78,sh#*.35,Ucolor,Ucolor,Ucolor,Ucolor
return