Simple app to create colors and make some random cool ones.
-- Random Color Picker
-- Initialize sliders used to pick colors. Set initial random rgb values.
function setup()
parameter.number("Red", 0, 255, randomColorCode())
parameter.number("Green", 0, 255, randomColorCode())
parameter.number("Blue", 0, 255, randomColorCode())
displayMode(FULLSCREEN)
end
function draw()
-- color is redered to the background.
background(Red, Green, Blue)
end
function touched(touch)
-- if the screen is touched and it is a BEGAN touch randomize the color.
if touch.state == BEGAN then
Red = randomColorCode()
Green = randomColorCode()
Blue = randomColorCode()
end
end
-- Helper function to return new random color code value.
function randomColorCode()
return math.random(0, 255)
end