[Tex/LaTex] How to draw a horizontal rule with a colour gradient


enter image description here

Look at the two blue coloured rules with a colour gradient. This is what I'm looking for. Thank You.

Best Answer

You can control the distance between the gradients and text changing the values 1em for example. Also, the height for rectangle could be changed 1.5em.

\usepackage{lipsum}%dummy text only
    \fill[cyan,path fading=east] (0,1em) rectangle (\linewidth,1.5em);
    \node at (.5\linewidth,0) {\bfseries #1};
    \fill[cyan,path fading=west] (0,-1em) rectangle (\linewidth,-1.5em);


enter image description here