Open chrjabs opened 5 months ago
Thanks for your pull request! I had a quick look at the code, but did not have time yet to test. Just some things I'm wondering about:
shouldn't the option be documented for both kinds of colourboxes?
on the left hand side, the shadow is visible behind the semi-transparent box:
Good points, I entirely missed that beamerboxesrounded
is documented. I added the missing documentation and fixed the shadow clipping.
One point to think about: with the default value of 1, the opacity will no longer adopt to the surrounding opacity. This means existing code like https://tex.stackexchange.com/a/656921/36296 or https://tex.stackexchange.com/a/331416/36296 will no longer give the desired result.
Right. I guess one could leave \bmb@bgopacity
undefined by default and only call \pgfsetfillopacity
if it is defined. Or did you have another idea for how to deal with this?
Right. I guess one could leave
\bmb@bgopacity
undefined by default and only call\pgfsetfillopacity
if it is defined. Or did you have another idea for how to deal with this?
Yes, this could work.
Or maybe avoid all potential backwards compatibility problems by creating a new transparent box?
Got around to implementing this with not defining \bmb@bgopacity
by default. The example from https://tex.stackexchange.com/a/656921/36296 seems to build without an issue.
I am not entirely sure what would happen now if you do something like this:
\begin{beamercolorbox}[bgopacity=.5]
\begin{beamercolorbox}
\end{beamercolorbox}
\end{beamercolorbox}
I suppose the inner box would still be drawn with 0.5 opacity, but I think this is a pretty niche case and can be easily fixed by setting bgopacity=1
on the inner box.
I am working on a beamer theme right now and found myself wanting colorboxes with truly transparent backgrounds. I found a stackexchange post addressing this topic and then noticed that implementing this as a proper parameter
bgopacity
forbeamercolorbox
andbeamerboxesrounded
does not seem too hard.The result is cleanest for non-rounded boxes, as they are drawn as one shape. For rounded boxes, especially with a heading, the box can sometimes get tiny gaps, as the shapes can't overlap with transparent background colours. I made sure that the shapes still overlap when no transparency is used, so that the gaps don't appear in this case.
Here is an example of what I get with my code.
The LaTeX code to generate the example above
```latex \documentclass[xcolor=usenames,dvipsnames]{beamer} \colorlet{color1}{PineGreen} \modeThe implementation is based on this stackexchange post and I made the following additional modifications:
rounded=false
: the stackexchange post only made modifications tobeamerboxesrounded
, not to non-rounded boxes that are drawn directly inbeamercolorbox
bgopacity=1
: in order to make sure I'm not messing anything up, pretty much all changes are guarded byif bgtransparency != 1
(looking through the theme examples in the userguide, they all still look fine to me)