%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Documentation for the rainbow colour theme % A beamer colour theme which alternates theme colours on every frame % Maintained by samcarter % % Project repository and bug tracker: % https://github.com/samcarter/beamertheme-rainbow % % Released under the LaTeX Project Public License v1.3c or later % See https://www.latex-project.org/lppl.txt % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % !TeX program = txs:///arara % arara: latexmk: { % arara: --> engine: pdflatex, % arara: --> options: [ % arara: --> '-shell-escape', % arara: --> '-synctex=1', % arara: --> '-interaction=nonstopmode', % arara: --> ] % arara: --> } \documentclass{scrartcl} % meta %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \title{\texorpdfstring{\gradient{HSB}{The rainbow beamer colour theme}{0,240,200}{240,240,200}}{The rainbow beamer colour theme}} \subtitle{A beamer colour theme which alternates theme colours on every frame} \author{% \texorpdfstring{ \texttt{samcarter}\\ \url{https://github.com/samcarter/beamertheme-rainbow}\\ \url{https://www.ctan.org/pkg/beamertheme-rainbow} }{samcarter}} \date{Version v1.0 \textendash{} 2024/11/14} \usepackage[ themecolor=samlila ]{\jobname-settings} % rainbow text (based on the gradient-text package) %%%%%%%%%%%%%%%%% \makeatletter \ExplSyntaxOn \clist_new:N\l_gtext_First_clist \clist_new:N\l_gtext_Last_clist \int_new:N\l_gtext_MaxIndex_int \int_new:N\l_gtext_Ratio_int \newcommand{\gr@dient}[8]{ \int_set:Nn\l_gtext_MaxIndex_int{\int_eval:n{\str_count:n{#1}}} \int_step_inline:nnn{1}{\l_gtext_MaxIndex_int}{ \exp_args:Ne\str_if_eq:nnTF{\str_item:Nn{#1}{##1}}{~}{}{ \int_set:Nn\l_gtext_Ratio_int{\int_eval:n{\l_gtext_Ratio_int+1}} } \color_select:nn{#8}{ \int_eval:n{(\int_use:N\l_gtext_Ratio_int*#5+(\l_gtext_MaxIndex_int-##1)*#2)/\l_gtext_MaxIndex_int}, \int_eval:n{(\int_use:N\l_gtext_Ratio_int*#6+(\l_gtext_MaxIndex_int-##1)*#3)/\l_gtext_MaxIndex_int}, \int_eval:n{(\int_use:N\l_gtext_Ratio_int*#7+(\l_gtext_MaxIndex_int-##1)*#4)/\l_gtext_MaxIndex_int} }\str_item:Nn{#1}{##1} } } \NewDocumentCommand\gradient{mmmm}{{ \clist_set:Nn\l_gtext_First_clist {#3} \clist_set:Nn\l_gtext_Last_clist {#4} \gr@dient{#2} {\clist_item:Nn\l_gtext_First_clist{1}} {\clist_item:Nn\l_gtext_First_clist{2}} {\clist_item:Nn\l_gtext_First_clist{3}} {\clist_item:Nn\l_gtext_Last_clist{1}} {\clist_item:Nn\l_gtext_Last_clist{2}} {\clist_item:Nn\l_gtext_Last_clist{3}} {#1} }} \ExplSyntaxOff \makeatother % customisation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \renewcommand*\dictumwidth{0.35\linewidth} \renewcommand*{\dictumrule}{\vskip1ex} \renewcommand*{\dictumauthorformat}[1]{#1} \newcommand{\prefix}{./include} \tcbset{ compilable listing/.style={listing file={\prefix/\jobname-listing-\thetcblistingcount.tex}}, run pdflatex/.style={run@system@command={cd\space \prefix;\space pdflatex}{\jobname-listing-\thetcblistingcount.tex}},% } \begin{document} \maketitle \dictum[Marc Chagall]{Colour is all. When colour is right, form is right. Colour is everything, colour is vibration like music; everything is vibration.} \section{Introduction} \label{intro} The rainbow beamer colour theme will bring more colours to your presentation. It works similarly to the structure beamer colour theme, but instead of having just one theme colour throughout the whole presentation, the rainbow beamer colour theme will cycle through a list of colours and change the theme colour on every frame or (sub)section. By default, it will cycle through colours of the rainbow (hence the name), but a custom set of colours is also possible. The package is included in \texlive and \miktex and available from \CTAN (\url{https://www.ctan.org/pkg/beamertheme-tcolorbox}). The development version of this package is located at \url{https://github.com/samcarter/beamertheme-rainbow}. If you have any problems, ideas or other feedback, please make constructive use of the issue tracker. Copyright \raisebox{0.2em}{\tiny\fontfamily{cmr}\selectfont\textcopyright} \texttt{samcarter}. Permission is granted to copy, distribute and\slash or modify this software under the terms of the LaTeX project public licence, version 1.3c or later \url{https://www.latex-project.org/lppl.txt}. \section{Usage} The basic usage is fairly simple. After choosing a beamer theme, one can load the rainbow beamer colour theme via \begin{tcolorbox}[title={Usage}] \begin{samcode} \usecolortheme{rainbow} \end{samcode} \end{tcolorbox} This will work with most of the themes which are provided by the beamer class as well some third party themes. Notable exceptions are the \saminline|AnnArbor| and \saminline|CambridgeUS| themes. This basic usage will colour frames in alternating rainbow colours: \nopagebreak \begin{tcblisting}{ listing and comment, pdf comment, freeze pdf, compilable listing, run pdflatex, comment={ \begin{tikzpicture} \foreach \i in {1,...,6}{% \node at (0.35*\i,-0.7*\i) {\includegraphics[page=\i,width=3.7cm]{beamertheme-rainbow-doc-listing-1.pdf}}; } \end{tikzpicture} }, title={Basic example} } \documentclass{beamer} \usetheme{Berkeley} \usecolortheme{rainbow} \begin{document} % just for this test example \ExplSyntaxOn \prg_replicate:nn{6}{ \begin{frame} \end{frame} } \ExplSyntaxOff \end{document} \end{tcblisting} As pretty as rainbow colours are, there might be some users who would like to choose their own colours. This can be done with the \saminline|colors={...}| option which accepts a comma separated list of colours. The colours can be predefined colours e.g. from the \saminline|xcolor| package, user-defined colours or (for more fun) from the \saminline|xkcdcolors| package. \begin{tcblisting}{ listing and comment, pdf comment, freeze pdf, compilable listing, run pdflatex, comment={ \begin{tikzpicture} \foreach \i in {1,...,6}{% \node at (0.35*\i,-0.7*\i) {\includegraphics[page=\i,width=3.7cm]{beamertheme-rainbow-doc-listing-2.pdf}}; } \end{tikzpicture} }, title={\strut Custom colours} } \documentclass{beamer} \usetheme{Copenhagen} \usepackage{xkcdcolors} \definecolor{mycolor}{RGB}{101,67,159} \usecolortheme[ colors={ orange, mycolor, xkcdMediumBlue } ]{rainbow} \begin{document} % just for this test example \ExplSyntaxOn \prg_replicate:nn{6}{ \begin{frame} \frametitle{Title} \end{frame} } \ExplSyntaxOff \end{document} \end{tcblisting} Changing the colour on every frame might be too frequent. For these use cases, the theme offers the option \saminline|auto=...|, which allows the user to control when automatic colour changes should happen. Possible values are \saminline|frame| (default), \saminline|section| and \saminline|subsection|. All other values will disable automatic colour changes. \begin{tcblisting}{ listing and comment, pdf comment, freeze pdf, compilable listing, run pdflatex, comment={ \begin{tikzpicture} \foreach \i in {1,...,3}{% \node at (0.35*\i,-0.7*\i) {\includegraphics[page=\i,width=3.7cm]{beamertheme-rainbow-doc-listing-3.pdf}}; } \end{tikzpicture} }, title={\strut Automatic colour changing} } \documentclass{beamer} \usetheme{Bergen} \usecolortheme[ colors={blue,red}, auto=section ]{rainbow} \begin{document} \begin{frame} \end{frame} \section{Section} \begin{frame} \end{frame} \begin{frame} \end{frame} \end{document} \end{tcblisting} It is also possible to manually change to the next colour using the macro \saminline|\rainbow|: \begin{tcblisting}{ listing and comment, pdf comment, freeze pdf, compilable listing, run pdflatex, comment={ \begin{tikzpicture} \foreach \i in {1,...,3}{% \node at (0.35*\i,-0.7*\i) {\includegraphics[page=\i,width=3.7cm]{beamertheme-rainbow-doc-listing-4.pdf}}; } \end{tikzpicture} }, title={\strut Manual colour changing} } \documentclass{beamer} \usetheme{Rochester} \usecolortheme[ colors={orange,teal}, auto=none ]{rainbow} \begin{document} \begin{frame} \frametitle{Title} \end{frame} \begin{frame} \frametitle{Title} \end{frame} \rainbow \begin{frame} \frametitle{Title} \end{frame} \end{document} \end{tcblisting} \end{document}