使用 CambridgeUS 更改投影机的颜色和标题

使用 CambridgeUS 更改投影机的颜色和标题

如何更改标题和主题的红色

如何调整header1和header2的位置?

\documentclass{beamer}

\usetheme{CambridgeUS}


% Set Color ==============================

% Custom colors
\usepackage{xcolor}

% http://www.computerhope.com/htmcolor.htm
\definecolor{gold}{HTML}{FDD017}
\definecolor{deep sky blue}{HTML}{3BB9FF}
\definecolor{light sky blue}{HTML}{82CAFA}

\makeatletter
\definecolor{mybackground}{HTML}{82CAFA}
\definecolor{myforeground}{HTML}{0000A0}

\setbeamercolor{normal text}{fg=black,bg=white}
\setbeamercolor{alerted text}{fg=red}
\setbeamercolor{example text}{fg=black}

\setbeamercolor{background canvas}{fg=myforeground, bg=white}
\setbeamercolor{background}{fg=myforeground, bg=mybackground}

\setbeamercolor{palette primary}{fg=black, bg=gray!30!white}
\setbeamercolor{palette secondary}{fg=black, bg=gray!20!white}
\setbeamercolor{palette tertiary}{fg=black, bg=gold}
\makeatother
% Set Color ==============================



\title{Title1}
\subtitle{Title2}
\author{Author}
\institute{Institute}
\date{Date}


\begin{document}

\frame{

}

\section[Outline]{}
\frame{\tableofcontents}

\section{Header1}
\subsection{Header2}
\frame{\frametitle{Topic1}
%
HTML color codes are the \textbf{hexadecimal triplets} representing the colors red, green, and blue.
\vspace{0.25cm}
%
These color codes can be used to change the color of the background, text, and tables on a web page.
}
%
%
\end{document}

标题 1 和 2 标题

主题 1 和标题 1 & 2 话题

左对齐或右对齐、居中 左对齐或右对齐、居中

答案1

要更改框架标题以及标题和副标题的颜色,您需要重新定义beamer颜色frametitletitle

\setbeamercolor{frametitle}{<color>}
\setbeamercolor{title}{<color>}

要更改标题的位置,您需要重新定义headline外部主题中定义的模板infolines(由 内部使用CambridgeUS)。这是原始定义:

\defbeamertemplate*{headline}{infolines theme}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,right]{section in head/foot}%
    \usebeamerfont{section in head/foot}\insertsectionhead\hspace*{2ex}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,left]{subsection in head/foot}%
    \usebeamerfont{subsection in head/foot}\hspace*{2ex}\insertsubsectionhead
  \end{beamercolorbox}}%
  \vskip0pt%
}

如您所见,第一个框的对齐方式beamercolorboxright,第二个框的对齐方式是left:您可以根据需要更改这些。

在下面的例子中,我使用了青色作为标题(不是最好的选择),并且我center在两个框中都使用了headline

\documentclass{beamer}

\usetheme{CambridgeUS}


% Set Color ==============================

% Custom colors
\usepackage{xcolor}

% http://www.computerhope.com/htmcolor.htm
\definecolor{gold}{HTML}{FDD017}
\definecolor{deep sky blue}{HTML}{3BB9FF}
\definecolor{light sky blue}{HTML}{82CAFA}

\definecolor{mybackground}{HTML}{82CAFA}
\definecolor{myforeground}{HTML}{0000A0}

\setbeamercolor{normal text}{fg=black,bg=white}
\setbeamercolor{alerted text}{fg=red}
\setbeamercolor{example text}{fg=black}

\setbeamercolor{background canvas}{fg=myforeground, bg=white}
\setbeamercolor{background}{fg=myforeground, bg=mybackground}

\setbeamercolor{palette primary}{fg=black, bg=gray!30!white}
\setbeamercolor{palette secondary}{fg=black, bg=gray!20!white}
\setbeamercolor{palette tertiary}{fg=black, bg=gold}

\setbeamercolor{frametitle}{fg=cyan!80!black}
\setbeamercolor{title}{fg=cyan!80!black}

\setbeamertemplate{headline}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,center]{section in head/foot}%
    \usebeamerfont{section in head/foot}\insertsectionhead\hspace*{2ex}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,center]{subsection in head/foot}%
    \usebeamerfont{subsection in head/foot}\hspace*{2ex}\insertsubsectionhead
  \end{beamercolorbox}}%
  \vskip0pt%
}

% Set Color ==============================

\title{Title1}
\subtitle{Title2}
\author{Author}
\institute{Institute}
\date{Date}


\begin{document}

\frame{\maketitle}

\section[Outline]{}
\frame{\tableofcontents}

\section{Header1}
\subsection{Header2}
\frame{\frametitle{Topic1}
%
HTML color codes are the \textbf{hexadecimal triplets} representing the colors red, green, and blue.
%
These color codes can be used to change the color of the background, text, and tables on a web page.
}

\end{document}

在此处输入图片描述

相关内容