% !TeX root = ./testing/test.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % 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 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ProvidesPackage{beamercolorthemerainbow}[2024/11/14 version v1.0 Beamer colour theme with alternating theme colours] \mode %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Default colours % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \definecolor{rainbow@0}{HTML}{e50000} \definecolor{rainbow@1}{HTML}{ff8d00} \definecolor{rainbow@2}{HTML}{ffee00} \definecolor{rainbow@3}{HTML}{028121} \definecolor{rainbow@4}{HTML}{004cff} \definecolor{rainbow@5}{HTML}{770088} \colorlet{beamer@structure@color}{rainbow@0} \setbeamercolor{structure}{fg=beamer@structure@color} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Reading theme options % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \DeclareOptionBeamer{colors}{\def\rainbow@colors{#1}} \DeclareOptionBeamer{auto}{\def\rainbow@auto{#1}} \ExecuteOptionsBeamer{colors={rainbow@0,rainbow@1,rainbow@2,rainbow@3,rainbow@4,rainbow@5},auto=frame} \ProcessOptionsBeamer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Defining colours % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ExplSyntaxOn % list to store colour list \clist_new:N \l_rainbow_clist \clist_set:Nx \l_rainbow_clist \rainbow@colors \newcounter{rainbow@count} % macro to switch to next colour \newcommand{\rainbow}{ \addtocounter{rainbow@count}{1} \colorlet{beamer@structure@color}{ \clist_item:Nn \l_rainbow_clist { \int_eval:n { \int_mod:nn { \value{rainbow@count} }{ \clist_count:N \l_rainbow_clist } + 1 } } } } % switch colour at start of frame \str_if_eq:eeT { \rainbow@auto } { frame } { \pretocmd{\beamer@@@frame}{ \ifnum\thepage>1 \rainbow \fi }{}{} } % switch colour at start of section \str_if_eq:eeT { \rainbow@auto } { section } { \AddToHook{cmd/section/before}{% \ifnum\thepage>1 \rainbow \fi } } % switch colour at start of subsection \str_if_eq:eeT { \rainbow@auto } { subsection } { \AddToHook{cmd/subsection/before}{% \ifnum\thepage>1 \rainbow \fi } } % initially use first colour from the list \AtBeginDocument{ \setcounter{rainbow@count}{-1} \rainbow } \ExplSyntaxOff \mode