Press 'r' for randomness.
Press 'h' to toggle interface.

View on a bigger screen for more control.

Gradient 2

Assign a random colour to all cells in the top and bottom rows and create colour interpolation between them.

Logic: Each cell in the top and bottom row (or the left and right column if horizontal orientation is selected) is randomly assigned a colour from the predefined palette of five colours. Next, a colour interpolation is created in the remaining cells.