How can I change material color smoothly with C# like in Magnets Game?

Hello everybody. I am trying to make a game using the same background like in MAGNETS GAME.

Please take a look at this video and you will see what exactly i am looking for.

MAGNETS GAME VIDEO

How can we change the color like in this game ?

Here is a simple script to rotate through hues :wink:

using UnityEngine;
using System.Collections;

public class HueRotater : MonoBehaviour {

	public float hue = 0f;
	public float sat = 1f;
	public float val = 1f;
	public float speed = 0.0005f;
	private Renderer rend;

	// Use this for initialization
	void Start () {
		rend = GetComponent<Renderer>();
	}
	
	// Update is called once per frame
	void Update () {
		if (hue < 1) {
			hue = hue + speed;
		} else {
			hue = 0;
		}
		rend.material.color = Color.HSVToRGB (hue, sat, val);
	}
}

[65123-huerotate.zip|65123]

Let me know if this helps :wink: