1

I am trying to draw a large colored text along a path, where the color follows a gradient.

I found posts describing how to draw text along a path and posts showing how to draw colored text with gradients, but the two techniques don't seem to mix as easily.

The effect I'm trying to obtain is shown in the picture below:enter image description here

Any idea how I could obtain this?

--- EDIT 2 ---

Preferably, I'd like to have a gradient visible on each character rather than a single, solid color on each character.

--- EDIT ---

I tried to mix a text along a path, like the following one:

\resizebox{0.5\linewidth}{!}{
\begin{tikzpicture}
\draw[left color=orange!30, right color = orange,decoration={text along path,
      text={|\Huge\bfseries|GRADIENT},text align={center}},font=\tiny,decorate] (155:2.75) arc (155:25:2.75);
\end{tikzpicture}
}

with a colored text with gradient, e.g.:

\begin{tikzfadingfrompicture}[name=mypic]
  \node [text=transparent!20]
    {\fontfamily{ptm}\fontsize{45}{45}\bfseries\selectfont GRADIENT};
\end{tikzfadingfrompicture}
\begin{tikzpicture}
    \fill [white] (-5,-1) rectangle (5,1);
  \shade[path fading=mypic,fit fading=false, left color=orange!30,right color=orange]
    (-5,-1) rectangle (5,1);
\end{tikzpicture}

but I have no idea how to use my first tikzpicture as a tikzfadingfrompicture. Simply replacing one for the other as follows (of course) doesn't work:

\begin{tikzfadingfrompicture}[name=mypic]
\draw[text=transparent!20,decoration={text along path,
      text={|\Huge\bfseries|GRADIENT},text align={center}},font=\tiny,decorate] (155:2.75) arc (155:25:2.75);
\end{tikzfadingfrompicture}
\begin{tikzpicture}
    \fill [white] (-5,-1) rectangle (5,1);
  \shade[path fading=mypic,fit fading=false, left color=orange!30,right color=orange]
    (-5,-1) rectangle (5,1);
\end{tikzpicture}
  • 1
    Add the code of your unsuccessful attempts. – AndréC Aug 6 at 10:47
  • @AndréC Done, but really I have no clue how to proceed, as I'm not familiar with tikz. – Maiaux Aug 6 at 11:24
3

My try: (Reference: pgfmanual.pdf (V3.1.1), p. 651)

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text,math}
\begin{document}

\bfseries
\begin{tikzpicture}[decoration={text effects along path,
text={GRADIENT}, text align={center},
text effects/.cd,
character count=\i, character total=\n,
characters={text along path, evaluate={\c=\i/\n*100;},
text=brown!\c!black}}]
\path [decorate]
(0,2) .. controls ++(0,1) and ++(0,1) .. (2,2);
\end{tikzpicture}
\end{document}

enter image description here

| improve this answer | |
  • This is page 551 of which version of Tikz? – AndréC Aug 6 at 11:31
  • Sorry, Version 3.1.1. – user108724 Aug 6 at 11:32
  • 1
    No, this is not page 551 of manual 3.1.1 Where can we find the old TikZ and pgf manuals? – AndréC Aug 6 at 11:35
  • oh, sorry, it is 651. – user108724 Aug 6 at 11:37
  • Nice, but am I right that in this solution every character has a single color (and thus no gradient within a character)? – Maiaux Aug 6 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.