I've been thinking about your question and found a solution that supports different sizes of cells.
Idea is the following: you don't really need to create a new gradient for every cell, you can just create an image of this gradient once and then set its image to the background. It will resize nicely.