Linear gradient fill with multiple stops

Looking for a tikz-pgf solution to generate shapes with linear gradient fills that have multiple stops. So far I am able to get a single "stripe" with the following code snippet

\begin{tikzpicture}
\draw (0,0) rectangle (5,1);
\fill [left color=black,right color=black,middle color=white,shading angle=80] (0,0) rectangle (5,1);
\end{tikzpicture}


which produces the following picture

What I would like is an image with multiple gradient stops like the image below with the ability to vary the number of stops and their colors.

You can get shadings of this type with \pgfdeclarehorizontalshading.

\documentclass[tikz,border=3mm]{standalone}