Beamer - 无法更改幻灯片背景颜色

Beamer - 无法更改幻灯片背景颜色

好像我无法改变背景颜色,这是我的标题和我的测试(没有改变幻灯片的背景颜色,我只能改变文本的颜色):

    \documentclass[aspectratio=169]{beamer}
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \usepackage{biolinum}
    \usepackage{microtype}
    \usefonttheme[onlymath]{serif}
    \usetheme[nofirafonts]{focus}


\begin{document}

    \setbeamercolor{background canvas}{bg=black}
    \begin{frame}{Test}
    \textcolor{white}{black} **here it changes only the text color**
    \end{frame}
    
    \setbeamertemplate{background canvas}{}
    \setbeamercolor{background canvas}{bg=red}
    \begin{frame}{Test 2 }   
    Test             ** nothing changes from a standard slide **
    \end{frame}

\end{document}

答案1

Beamer 主题focus以 颜色 绘制背景normal text.bg,因此您对 颜色 的更改background canvas.bg不会产生任何效果。在下面的示例中,使用的颜色更改为background canvas.bg

\documentclass[aspectratio=169]{beamer}
\usetheme[nofirafonts]{focus}

% redefine beamer template "background canvas" with option "focus"
% originally defined in beamerouterthemefocus.sty
\expandafter\let\csname beamer@@tmpop@background canvas@focus\endcsname\relax
\defbeamertemplate{background canvas}{focus}{%
    \begin{tikzpicture}
        \clip (0,0) rectangle ++(\paperwidth,\paperheight);
        % use color "background cavas.bg" instead of "normal text.bg"
        \fill[background canvas.bg] (0,0) rectangle ++(\paperwidth,\paperheight);
    \end{tikzpicture}%
}

\begin{document}

    \setbeamercolor{background canvas}{bg=black}
    \begin{frame}{Test}
    \textcolor{white}{black} **here it changes only the text color**
    \end{frame}

    \setbeamercolor{background canvas}{bg=red}
    \begin{frame}{Test 2 }   
    Test             ** nothing changes from a standard slide **
    \end{frame}

\end{document}

在此处输入图片描述

相关内容