1

I would like my frametitle bg to fade horizontally to a background image.

I have attempted to modify the solution for vertical gradients found here: Beamer theme with fading (=gradient to transparent) to background image by replacing "fade bottom" with "fade right", etc. However I cannot get the frametitle to appear within the horizontally faded area (or to overlay any other text in this area)---the solution given here creates a faded overlay beneath the frame title (whereas I want the faded overlay to be behind the title). Essentialy, what I want is a fade-to-transparent version of what is found here: How can I have a horizontally shaded frametitle in beamer?

I am using the Madrid theme.

I would much appreciate any help you can offer.

Thanks!

Edit: (apologetically inelegant) code follows:

\documentclass[aspectratio=169]{beamer}
\usetheme{Madrid}

%For the semi-transparent text boxes
\usepackage[framemethod=tikz]{mdframed}
\newmdenv[tikzsetting={draw=black,fill=tan,fill opacity=0.92, line width=0pt},
backgroundcolor=none,leftmargin=10,rightmargin=10,innertopmargin=4pt]
{titleBox}

\usepackage{ragged2e}
\usepackage{etoolbox,color,amsfonts}
\justifying
\title{My title}
\author[me]{Me}
\institute{My institute}
\date{Date}

%For the semi-transparent footline
\setbeamertemplate{footline}
{
\leavevmode%
\hbox{%
\pgfsetfillopacity{.65}\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
\usebeamerfont{author in head/foot}\pgfsetfillopacity{1}\insertshortauthor~~(\insertshortinstitute)
\end{beamercolorbox}%
\pgfsetfillopacity{.75}\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
\usebeamerfont{title in head/foot}\pgfsetfillopacity{1}\insertshorttitle
\end{beamercolorbox}%
\pgfsetfillopacity{.65}\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
\usebeamerfont{date in head/foot}\pgfsetfillopacity{1}\insertshortdate{}\hspace*{2em}
\insertframenumber{} / \inserttotalframenumber\hspace*{2ex}
\end{beamercolorbox}}%
\vskip0pt%
}

%Various color/structure definitions (some of the custom colors are used elsewhere)
\definecolor{tan}{RGB}{244,229,192}
\definecolor{mypurple}{RGB}{88,68,70}
\definecolor{mytan}{RGB}{255,199,0}
\definecolor{wyte}{RGB}{210,210,210}
\setbeamercolor*{palette primary}{use=structure,fg=tan,bg=mypurple}
\setbeamercolor*{palette secondary}{use=structure,fg=mypurple,bg=tan}
\setbeamercolor*{palette tertiary}{use=structure,fg=tan,bg=mypurple}
\setbeamercolor{item projected}{fg=white,bg=mypurple}
\setbeamertemplate{enumerate items}[default]
\setbeamertemplate{navigation symbols}{}
\setbeamercolor{block title}{fg=mypurple}
\setbeamercolor{local structure}{fg=mypurple}
\setbeamertemplate{itemize item}[triangle]
\setbeamercolor{block title}{fg=white,bg=mypurple}
\setbeamercolor{block body}{fg=black,bg=wyte}
\setbeamercolor{title}{fg=black, bg=mytan}
\setbeamertemplate{title page}[default][colsep=-4bp,rounded=true]
\setbeamercolor*{frametitle}{fg=tan}

\usepackage{graphicx}

%For background image
\usebackgroundtemplate%
{%
\includegraphics[width=\paperwidth,height=\paperheight]{intro.jpg}%
}

\begin{document}

\begin{frame
\begin{titleBox}
\begin{center}
My Title
\end{center}
\end{titleBox}
\end{frame}

\begin{frame}{Introduction}%The title bg here is what I want to fade; but not the fg
\begin{titleBox}
Goal of the talk...
\end{titleBox}

\end{frame}
\end{document}
  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – cfr Feb 22 '15 at 21:59
1

Here is a solution. It's rather inelegant as it involves vertical re-positioning of separate boxes---one for the fade, and a separate for the frametitle. The right hand side of the fade is somewhat sharper than I'd like, but here goes the relevant code addition:

\usepackage{tikz}
\usetikzlibrary{fadings}%To set up the fade parameters
\begin{tikzfadingfrompicture}[name=fade right]
\shade[left color=transparent!15,
right color=transparent!100] (0,0) rectangle (2,2);
\end{tikzfadingfrompicture}

\setbeamertemplate{headline}
{
\hbox{%For the fade box---this has to come first otherwise the title won't appear ``on top'' of the faded box                                                                                                                                                                                                            
\tikz\fill[scale=1.5,path fading= fade right, mypurple] (0,0) rectangle (.45\paperwidth,0.5);
        }%

\vspace{-3.5em} 

\hbox{%For the frame title
\pgfsetfillopacity{0}\begin{beamercolorbox}[wd=\paperwidth,ht=5.5ex,dp=3ex,left]{frame title}%
\usebeamerfont{frame title}\pgfsetfillopacity{1}\hspace{1em}{\large\insertframetitle}
\end{beamercolorbox}}%
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.