1

So I'm new to the Tikz-package and I would like to know how I can make following line:What I want

Now, I don't know how to do that, but I'm able to make these two lines (the exact color doesn't matter): What I have The two lines I created are slightly different from what I want. Line 1 has on the right side some kind of edge which I don't really like. Line 2 has on the left side a sharp edge and I would like to have it rounded.

So what I want is a combination of line 1 and line 2, but I don't know how to do this. I hope someone does and wants to help me.

This is my code for the two lines I have:

\documentclass{report}
\usepackage{tikz}
\definecolor{color1}{RGB}{120, 0, 0}

\begin{document}

    1
    % This is what I have, but on the right side
    % of the line, there's some kind of edge that
    % bothers me.
    \begin{tikzpicture}
    \fill[
        draw=none,
        line width=0pt,
        rounded corners=1.5pt,
        left color=color1,
        right color=white
    ]
    rectangle ++(\textwidth,-3pt);
    \end{tikzpicture}

    2
    % This is another thing I have, but now the
    % left side is a sharp edge. I would like the
    % sharp edge to turn into a rounded corner
    % without the right side changing.
    \begin{tikzpicture}
        \fill[
            draw=none,
            line width=0pt,
            left color=color1,
            right color=white
        ]
        rectangle ++(\textwidth,-3pt);
    \end{tikzpicture}

\end{document}
Mario
  • 105

1 Answers1

3

What you want is just a shaded path. Use\pathinstead of \fill.

\begin{tikzpicture}
    \path[
        line width=0pt,
        rounded corners=1.5pt,
        left color=color1,
        right color=white
    ]
    rectangle ++(\textwidth,-3pt);
\end{tikzpicture}