Beamer-块环境中的阴影背景

Beamer-块环境中的阴影背景

我想在我的 Beamer 演示文稿中使用阴影彩色块标题背景。我不知道如何设置阴影。有什么解决办法吗?

\documentclass[]{beamer} 
\usepackage{lmodern} 
\usepackage{tikz} 
\usepackage[utf8]{inputenc} 
\usepackage[ngerman]{babel} 
\usepackage[T1]{fontenc} 

\setbeamertemplate{blocks}[rounded][shadow=true] 
\setbeamercolor{block title}{fg=black,bg=black!70} 
\setbeamercolor{block body}{fg=white,bg=black} 


\begin{document} 

\begin{frame} 

\begin{block}{Title which background color i like to shade} 
Block entry
\end{block} 

\end{frame} 

\end{document} 

答案1

类似这样的事?

\documentclass[]{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[most]{tcolorbox}

\setbeamertemplate{blocks}[rounded][shadow=true]
\setbeamercolor{block title}{fg=black,bg=black!70}
\setbeamercolor{block body}{fg=white,bg=black}

\newtcolorbox{myblock}[2][]{beamer,title=#2,fonttitle=\sffamily,
  left=1mm,right=1mm,top=1mm,bottom=1mm,arc=2mm,
  colback=black,colupper=white,colframe=yellow,
  coltitle=black,title style={top color=red!70,bottom color=yellow},
  #1}

\begin{document}

\begin{frame}

\begin{block}{Title which background color i like to shade}
Block entry
\end{block}

\begin{myblock}{Title which background color i like to shade}
Block entry
\end{myblock}

\end{frame}

\end{document}

在此处输入图片描述

答案2

您可以使用 tcolorbox 内部主题作为起点并添加如下颜色渐变:

\documentclass{beamer} 

\setbeamercolor{block title}{fg=black,bg=black!70} 
\setbeamercolor{block body}{fg=white,bg=black} 

\useinnertheme[rounded,shadow]{tcolorbox}
\tcbset{
  title style={
    bottom color=cyan,
    top color=orange
  }
}

\begin{document} 

\begin{frame} 

\begin{block}{Title which background color i like to shade} 
Block entry
\end{block} 

\end{frame} 

\end{document} 

在此处输入图片描述

相关内容