# Specify positions for top/bottom in Beamer vertical shading

MWE

\documentclass{beamer}

% Yes, this is a poster, if that matters in the slightest
%\usepackage[orientation=portrait,size=a0]{beamerposter}
\mode<presentation>{}

\setbeamertemplate{background canvas}
[bottom=blue!15,top=blue!0,midpoint=.1]

\begin{document}
\begin{frame}[t]{Title!}
Content!
\end{frame}
\end{document}


What I'd like to be able to do is set top/bottom the same way I set midpoint, since (the title area being white) the junction of the white background with a sudden and noticeable blue is extremely offsetting.

I've looked through the manual, but to my knowledge there is no explicit support for this.

• You may find this useful. – jub0bs Apr 22 '13 at 22:20
• @jubobs so basically you defined your own rectangle in which to shade things --- so it may require a bit of math, but these rectangles could potentially be stacked upon each other to produce the desired effect. – Sean Allred Apr 22 '13 at 22:34
• Yes. Don't hesitate to post a solution to your own question here if you achieved the desired effect. – jub0bs Apr 23 '13 at 8:26
• @JosephWright I never did run with this idea, but I'll see if I can draw something up (at least on the small scale). At the very least, someone more PGF-y can come along and automate it if they so desire. – Sean Allred Aug 14 '13 at 12:42

Well, midpoint wasn't doing what I thought it was doing, anyway :) If I recall correctly, I wanted to keep the title area completely white. This can be done by setting the middle color to white and setting the midpoint to taste:

\setbeamertemplate{background canvas}[vertical shading]
[bottom=blue!5,top=white,middle=white,midpoint=.75]


However, if you want a more general solution, you can define arbitrary gradient anchors by redefining one of PGF's internal macros:

\makeatletter
{\usebeamercolor{palette primary}}
\usebeamercolor{normal text}
\ifx\beamer@bgsm\@empty
{
% ALTER THESE VALUES
color(0cm)=(\beamer@bgsb);
color(\the\paperheight)=(\beamer@bgst)
}
\else
{
% OR PERHAPS THESE VALUES IF YOU'RE USING MIDDLE
color(0cm)=(\beamer@bgsb);
color(\beamer@bgsmp\paperheight)=(\beamer@bgsm);
color(\the\paperheight)=(\beamer@bgst)
}
\colorlet{beamer@average}{\beamer@bgsm}
\fi%
}
\makeatother


A few notes on the relevant macros here:

• \beamer@bgst the top key value
• \beamer@bgsm the middle key value
• \beamer@bgsb the bottom key value
• \beamer@bgsmp the midpoint key value