Well, if you're wanting to color the inside of your button (which I believe is what you're trying to do), you could always add this into the drawing code of your button.
-- If it is only on 1 Y plane, which I believe it is in your code.
paintutils.drawLine(x1,y,x2,y,color)
-- Or if you want your button to be on multiple Y planes.
for i=1,y2-y do
paintutils.drawLine(x1,y+i-1,x2,y+i-1,color)
end
Also, I suggest you change your code a bit to support multiple buttons, because with the way it is now, it wouldn't work very well if you had more then 1.
For instance, you could register all of your buttons to a table like this,
local Buttons = {}
function RegisterButton(x1,y1,x2,y2,color,func,name)
Buttons[name] = {x1,y1,x2,y2,color,func}
end
Then you could just have a main function that handles the drawing and mouse events for the buttons.
function Handler()
for k,v in pairs(Buttons) do
for i=1,Buttons[k][4]-Buttons[k][2] do
paintutils.drawLine(Buttons[k][1],Buttons[k][2]+i-1,Buttons[k][3],Buttons[k][2]+i-1,Buttons[k][5])
end
end
local ev,p1,p2,p3,p4,p5 = os.pullEvent() -- This setup allows for additional events to be handled here, not just mouse events.
if ev == "mouse_click" then
for k,v in pairs(Buttons) do
if p2 >= Buttons[k][1] and p2 <= Buttons[k][3] and p3 >= Buttons[k][2] and p3 <= Buttons[k][4] then
Buttons[k][6]() -- Calls the Button's function.
end
end
end
end
Here is some example code to go with the functions provided.
RegisterButton(1,1,4,4,colors.blue,function() print("Hi!") end,"Test")
Handler()
And that code should be ready to run right away. Of course, it would certainly need a bit more sprucing up and additions to it before you could call it a button API, but this should get you on your way :)/>
EDIT: You should probably add a loop for the handler function, but I have to go, so I can't change it right now.