The following is a Sass mixin I recently wrote to tackle an issue for a project on GitHub where they wanted to have their header background fade between a number of colors.
I set it up so a list of colors could be passed in and it wouldn’t matter how many colors you wanted; the interval would always be evenly divided amongst them.
Of Course… the above vendor prefix blocks are unnecessary if you’re using an auto-prefixer such as the one in css-next.
The above code renders the following:
You can grab the code from this Gist, as well.