4

I can't get the solution proposed here to work: Accessing colors defined by a beamer color theme for a standalone tikzpicture

\documentclass[hyperref={pdfpagelabels=false},xcolor=x11names,compress]{beamer}
\usetheme{Boadilla}
\usepackage{tikz}%Mind map
\usetikzlibrary{mindmap,trees} %Mind map
\usepackage{media9,multimedia,comment,booktabs,datetime}

\begin{document}
\begin{frame}
\frametitle{Literature Review}
%\tikzset{every node/.append style={scale=2}}
\resizebox{0.9\textwidth}{!}{
\hspace{50pt}\begin{tikzpicture}
 %\tikzstyle{every node}=[font=\Large,level distance=8cm]
    \path[mindmap,concept color=DeepSkyBlue4,text=white,font=\sf\bf,text width=5cm,
        level 1/.append style={level distance=6cm,sibling angle=60},
        level 2/.append style={level distance=4cm},]

        node[concept] {Learning}[clockwise from=0]
        child[concept color=DeepSkyBlue4] {
            node[concept] {practical}[clockwise from=90]
            child { node[concept] {algorithms} [clockwise from=40]
            child { node[concept] {databases} }
            child { node[concept] {WWW} }}
            child { node[concept] {data structures} }
        }  
        child[concept color=red,text=black] {
            node[concept] {applied}[clockwise from=360]
            child { node[concept,level distance=16cm,sibling angle=60] {databases} }
        }
        child[concept color=red,text=black] { 
            node[concept] {technical} 
        }
        child[concept color=red,text=black] { 
            node[concept,text width=2cm] {theoretical} 
        };
\end{tikzpicture}}
\end{frame}

\end{document}

How can I replace red above with whatever is set by the selected theme (or customized with \setbeamercolor*{palette tertiary}{fg=black,bg=black!10}? I want to do this for various tikzpicture, pgfplots etc.

6

I don't know why but some beamer colors are available (like structure.fg) and some others not. But you can always define your own colors based on beamer theme ones. This way, when you change beamer theme, all colors will change.

After

\usebeamercolor{block title alerted}
\colorlet{color1}{bg}

color1 will be equal to block title alerted.bg color. You can repeat this lines to define more colors. Next code shows an example with this solution.

Another solution is provided by Claudio Fiandrino in How to get actual values of colour theme colours in beamer? where a newcommand \ccft (Create color from template) is used to define normal colors based on beamer ones.

\documentclass[hyperref={pdfpagelabels=false},xcolor=x11names,compress]{beamer}
\usetheme{Boadilla}
\usepackage{tikz}%Mind map
\usetikzlibrary{mindmap,trees} %Mind map
\usepackage{media9,multimedia,comment,booktabs,datetime}

\usebeamercolor{block title alerted}
\colorlet{color1}{bg}
\usebeamercolor{block body}
\colorlet{color2}{bg}
\colorlet{color3}{bg!30!color1}

\setbeamercolor*{palette tertiary}{fg=red,bg=black!10}
\usebeamercolor{palette tertiary}
\colorlet{color4}{bg}

\begin{document}
\begin{frame}
\frametitle{Literature Review}
\resizebox{0.9\textwidth}{!}{
\hspace{50pt}\begin{tikzpicture}
    \path[mindmap,
        concept color=structure.fg,
        text=white,font=\sf\bf,text width=5cm,
       level 1/.append style={level distance=6cm,sibling angle=60},
       level 2/.append style={level distance=4cm},]

       node[concept] {Learning}[clockwise from=0]
       child[concept color=color1] {
            node[concept] {practical}[clockwise from=90]
            child { node[concept, concept color=color2] {algorithms} [clockwise from=40]
            child { node[concept] {databases} }
            child { node[concept] {WWW} }}
            child { node[concept] {data structures} }
        }  
        child[concept color=color3,text=black] {
            node[concept] {applied}[clockwise from=360]
            child { node[concept,level distance=16cm,sibling angle=60] {databases} }
        }
        child[concept color=color4,text=black] { 
            node[concept] {technical} 
        }
        child[concept color=color4!30!black, text=white] { 
            node[concept,text width=2cm] {theoretical} 
        };
\end{tikzpicture}}
\end{frame}

\end{document}

enter image description here

  • +1 Implicitly, this is the same trick my \ccft (Create Color From Template) is doing in the linked answer. – Claudio Fiandrino Mar 19 '14 at 12:12
  • @ClaudioFiandrino You're right! After a second lecture I've understood it. I've included a reference to your code. – Ignasi Mar 19 '14 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.