summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/beamer-contrib/themes/beamertheme-rainbow/beamercolorthemerainbow.sty
blob: f4f9a162ee4321d7fae49a075050784b7f6dce48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
% !TeX root = 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 http://www.latex-project.org/lppl.txt
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ProvidesPackage{beamercolorthemerainbow}[2024/04/28 version v0.2 Beamer colour theme with alternating theme colours]

\mode<presentation>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% 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}}
\ExecuteOptionsBeamer{colors={rainbow@0,rainbow@1,rainbow@2,rainbow@3,rainbow@4,rainbow@5}}
\ProcessOptionsBeamer

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Defining colours
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ExplSyntaxOn

% list to store colour list
\clist_new:N \l_rainbow_clist
\clist_set:Nx \l_rainbow_clist \rainbow@colors

% setting colour based on frame number
\pretocmd{\beamer@@@frame}{
  \colorlet{beamer@structure@color}{
    \clist_item:Nn \l_rainbow_clist {
      \int_eval:n {
        \int_mod:nn { \insertframenumber }{ 
          \clist_count:N \l_rainbow_clist
        } + 1
      }
    }
  }
}{}{}

\ExplSyntaxOff

\mode
<all>