47
$\begingroup$

I know there is a Notebook option WindowOpacity can be used to adjust the opacity of a whole notebook. But what I want is keeping the text and graphics and so on being Opacity[1] while the other parts of the window being Opacity[0.3], which may look like (the pic is roughly produced by photoshop):

enter image description here

I guess this effect might be achieved by capture the screen prior and set it as the background of a Cell/Cells. But even if that is applicable, it must be very inefficiency.

My questions are: how to achieve this transparent effect in Mathematica (maybe with some help from external applications)? and how to do it effectively?

$\endgroup$
6
  • 4
    $\begingroup$ Very cool. Didn't know you can change the opacity. $\endgroup$ Commented Jan 19, 2012 at 5:20
  • $\begingroup$ The documentation for Background says "The setting for Background can be any color or opacity specification" so I thought you could locally set Opacity at the cell level to override the WindowOpacity and get the sort of effect you want but I get an error message when I use Opacity with Background. $\endgroup$ Commented Jan 19, 2012 at 6:26
  • $\begingroup$ Fixed the background error but local Opacity settings at the cell level are being overridden by the WindowOpacity. Interesting problem. $\endgroup$ Commented Jan 19, 2012 at 6:37
  • $\begingroup$ @MikeHoneychurch Yes the window level option will override others. I'm working on a GUI application and trying to make it cooler.. $\endgroup$
    – Silvia
    Commented Jan 19, 2012 at 9:47
  • 1
    $\begingroup$ @Bflat Sadly, according to my Windows expert friend, the wanted effect might be very tricky and/or inefficient on Windows. $\endgroup$
    – Silvia
    Commented Jul 8, 2022 at 20:24

2 Answers 2

10
$\begingroup$

On Mac this works (but apparently only with WindowFrame->"PopupMenu"):

SetOptions[InputNotebook[], Background -> Opacity[.75, Red], 
 WindowFrame -> "PopupMenu"]

This is different than WindowOpacity.

$\endgroup$
1
  • 2
    $\begingroup$ Thanks ragfield. Unfortunately this seems not working on my Win7 box.. The background turned red, but no transparent. $\endgroup$
    – Silvia
    Commented Jan 19, 2012 at 16:40
9
$\begingroup$

If you turn on window opacity slightly, then background opacity will be factored in. Note a cell's background is mixed with the notebook's. Note that "Input" cells have a translucent LightBlue background, RGBColor[0.87, 0.94, 1, 0.6], that appears purplish.

SetOptions[InputNotebook[],
 WindowOpacity -> 0.9999, (* something slightly less than 1 *)
 Background -> Hue[0.95, 0.8, 1, 0.8]]

enter image description here

There is still a slight problem. It may be hard to see, but the input labels have a rectangle with a slight different color than the window background. It seems that it inherits the window background, and when the two are composited, the result is less translucent. This seems to be an issue whenever translucent backgrounds overlap. Since the OP seems interested only in cells with opaque background, this shouldn't be an issue except for the In/Out labels.

To fix the labels, edit the stylesheet. Enter the style name CellLabel and hit return. With the Options Inspector, change the backgrounds for both Cell Options > Display Options > Background and Formatting Options > Font Options > Background to have 0 opacity, with something like

RGBColor[0, 0, 0, 0]

(Just add the fourth entry 0; the others don't matter. For reasons I didn't track down, once the color was the notebook background, and once it was near white.)

$\endgroup$
3
  • 1
    $\begingroup$ Thanks Michael. Unfortunate this, like ragfield's solution, doesn't work in my MMA 9 on Windows 7... $\endgroup$
    – Silvia
    Commented Aug 20, 2013 at 1:55
  • $\begingroup$ @Silvia Oh, I'm sorry. I was hoping that WindowOpacity -> 0.9999 would trick it, as it does on Mac OS, for normal windows. Thanks for the question, anyway. $\endgroup$
    – Michael E2
    Commented Aug 20, 2013 at 3:12
  • $\begingroup$ In fact some days ago I had struggled to "simulated" it (with very low performance) with the new option in v9, but I don't have time and computer to arrange an answer current now. I'll post it as soon as I can. $\endgroup$
    – Silvia
    Commented Aug 23, 2013 at 3:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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