在 Beamer 中为项目着色

在 Beamer 中为项目着色

我想在 Beamer 中为某项着色。这是我的代码:

\documentclass[english,xcolor={dvipsnames}]{beamer}

\mode<article> % only for the article version
{
  \usepackage{fullpage}
  \usepackage{hyperref}
}


\mode<presentation>
{
  %\setbeamertemplate{background canvas}[vertical shading][bottom=red!10,top=blue!10]
  \setbeamercovered{transparent}
  \usefonttheme{serif}
  \usecolortheme{crane}
}

\usepackage{tikz}

\newcommand*\rounded[1]{\tikz[baseline=(char.base)]{
            \node[draw=none,ball color=Orange, shade,
 color=black, rounded corners=3.5pt, inner sep=2.5pt] (char) {#1};}}


\begin{document}

\begin{frame}
\rounded{1} I want to colour this rounded item with the colour of the body block below instead of ``Orange''...

\begin{block}{My block}
This is my block
\end{block} 
\end{frame}

\end{document} 

答案1

\documentclass[english,xcolor={dvipsnames}]{beamer}

\mode<article> % only for the article version
{
  \usepackage{fullpage}
  \usepackage{hyperref}
}


\mode<presentation>
{
  %\setbeamertemplate{background canvas}[vertical shading][bottom=red!10,top=blue!10]
  \setbeamercovered{transparent}
  \usefonttheme{serif}
  \usecolortheme{crane}
}

\usepackage{tikz}

\newcommand*\rounded[1]{%
{\usebeamercolor{block body}%
\tikz[baseline=(char.base)]{%
            \node[draw=none,fill=bg,rounded corners=3.5pt, inner sep=2.5pt] (char) {#1};}}}


\begin{document}

\begin{frame}
\rounded{1} I want to colour this rounded item with the colour of the body block below instead of ``Orange''...

\begin{block}{My block}
This is my block
\end{block} 
\end{frame}

\end{document} 

在此处输入图片描述

相关内容