I want to modify the width of the colorbox of the frametitle. Metropolis defines the frametitle like this:
\defbeamertemplate{frametitle}{plain}{%
\nointerlineskip%
\begin{beamercolorbox}[%
wd=\paperwidth,%
sep=0pt,%
leftskip=\metropolis@frametitle@padding,%
rightskip=\metropolis@frametitle@padding,%
]{frametitle}%
\metropolis@frametitlestrut@start%
\insertframetitle%
\nolinebreak%
\metropolis@frametitlestrut@end%
\end{beamercolorbox}%
}
The colored background should have a width like `wd=0.25\paperwidth`. How can I achieve this?
Top Answer
samcarter
You can change the width of the box by modifying the `wd` key. The resulting box won't be oversized anymore, so the horizontal position has also be adjusted:
```
\documentclass{beamer}
\usetheme{moloch}% modern fork of the metropolis theme
\makeatletter
\setbeamertemplate{frametitle}{%
\nointerlineskip%
\hskip-\beamer@leftmargin%
\begin{beamercolorbox}[%
wd=.25\paperwidth,%
sep=0pt,%
leftskip=\moloch@frametitle@padding,%
rightskip=\moloch@frametitle@padding,%
]{frametitle}%
\moloch@frametitlestrut@start%
\insertframetitle%
\nolinebreak%
\moloch@frametitlestrut@end%
\end{beamercolorbox}
}
\makeatother
\begin{document}
\begin{frame}
\frametitle{test}
test
\end{frame}
\end{document}
```
![Screen Shot 2020-07-09 at 13.59.27.png](/image?hash=c3a03cd9b15604b4371fd671cd6d06f315706fb3e406d2d8f5db2cd6e9de2c4f)