Color Generator

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

@heyitsgeo Welcome to the forum. It’s good to see new users posting code. Hope to see more from you. Anytime you post code, put ~~~ on a line before and after your code so it shows the correct way. I added them to your code above.

@dave1707 thanks for the update. I was struggling with getting the code to format the way I wanted to. I appreciate you going ahead and fixing it!

I’ve also been coding on a colors API. Here it is. I hope you can make us of it.