[Tex/LaTex] Draw shading rectangle

tikz-pgf

I want to draw something like this :
enter image description here

I read the tikz manuel where it talks about shading, but didn't find anything the thing I want.

Here his my MW:

\documentclass{article}
\usepackage{xcolor}
\usepackage{tikz} 
\usepackage{siunitx}
\begin{document}  
    \begin{figure}[H]
        \centering
            \begin{tikzpicture}[
                scale=0.8,
                transform shape,
                  ]
                \shade[left color=red,right color=green] (0,0) rectangle (\textwidth,2);
          \end{tikzpicture}
    \end{figure}
\end{document}          

With the output : enter image description here

Best Answer

enter image description here

\documentclass{article}
\usepackage{tikz}
\usepackage{siunitx}

\begin{document}
    \begin{figure}
        \centering
            \begin{tikzpicture}
                \shade[left color=red,
                       right color=green,
                       middle color=yellow] % <---
                       rectangle (\textwidth,2);
          \end{tikzpicture}
    \end{figure}
\end{document}