2

I want to create this horizental gradient coloring for text

enter image description here

and here the code to do it for each letter but I want to have a function to do this. function should get text, and 2 colors. note it should be able to correctly handle spaces(' ').

\documentclass{article}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{contour} % for outlining text

% Define colors
\definecolor{myred}{HTML}{FF0000}    % Red color
\definecolor{mymaroon}{HTML}{800000} % Maroon color

\begin{document}

% Gradient text simulation
\begin{center}
  {\Huge\bfseries
    \textcolor{myred!80!mymaroon}{\contour{white}{F}}%
    \textcolor{myred!70!mymaroon}{\contour{white}{A}}%
    \textcolor{myred!60!mymaroon}{\contour{white}{R}}%
    \textcolor{myred!50!mymaroon}{\contour{white}{H}}%
    \textcolor{myred!40!mymaroon}{\contour{white}{A}}%
    \textcolor{myred!30!mymaroon}{\contour{white}{N}}%
    \textcolor{myred!20!mymaroon}{\contour{white}{G}}%
    \textcolor{myred!10!mymaroon}{\contour{white}{ }}%
    \textcolor{myred}{\contour{white}{A}}%
    \textcolor{myred!10!mymaroon}{\contour{white}{M}}%
    \textcolor{myred!20!mymaroon}{\contour{white}{A}}%
    \textcolor{myred!30!mymaroon}{\contour{white}{J}}%
    \textcolor{myred!40!mymaroon}{\contour{white}{I}}
  }
  \\[10pt]
  {\Large AI Research Scientist \& Python Developer}
\end{center}

\end{document}

1 Answer 1

3

You could use the gradient-text package:

\documentclass{article}
\usepackage{xcolor}
\usepackage{gradient-text}

\begin{document}

% Gradient text simulation
\begin{center}
  {\Huge\bfseries
  \gradientRGB{FARHANG}{230,0,0}{135,0,0}
  \gradientRGB{AMAJI}{230,0,0}{135,0,0}\par
  }
  {\Large AI Research Scientist \& Python Developer\par}
\end{center}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .