Here's a TikZ solution adapted from an earlier answer of mine, which might be of interest in relation to Beamer, for example.
\documentclass[border=10pt,multi,tikz]{standalone}
% ateb: https://tex.stackexchange.com/a/701971/
% addaswyd o fy ateb: https://tex.stackexchange.com/a/344548/
\usetikzlibrary{fadings}
\usepackage{xparse}
\pgfdeclarehorizontalshading{rainbow}{100bp}{%
rgb(0bp)=(1,0,0);
rgb(26bp)=(1,0,0);
rgb(33bp)=(1,.5,0);
rgb(40bp)=(1,1,0);
rgb(47bp)=(0,1,0);
rgb(54bp)=(0,1,1);
rgb(61bp)=(0,0,1);
rgb(68bp)=(1,0,1);
rgb(75bp)=(.5,0,.5);
rgb(100bp)=(.5,0,.5)}
\begin{tikzfadingfrompicture}[name=wavedashing]
\node [text=transparent!0, inner sep=0pt] {\sffamily\bfseries\selectfont Wavedashing and You};
\end{tikzfadingfrompicture}%
\begin{document}
\begin{tikzpicture}
\shade [shading=rainbow, path fading=wavedashing, fit fading=false] (-18mm,-10mm) rectangle (18mm,10mm);
\end{tikzpicture}
\end{document}
