Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default window shadow dimensions for Snow Leopard?

I would like to emulate the default shadow applied to NSWindows with a CALayer shadow. I can't quite figure out the exact values for the the following properties though:

theLayer.shadowOffset = ?;
theLayer.shadowRadius = ?;
theLayer.shadowOpacity = ?;

I assume that the shadowColor is black (the default).

Does anyone have an idea what those values could be to get a native (Snow) Leopard window shadow?

EDIT:

To clarify, I'm asking if there's any system API that can give me those values. I don't want to hard code those values, as they have changed in the past and probably will change again at some point in the future.

like image 445
Matej Bukovinski Avatar asked Apr 15 '10 14:04

Matej Bukovinski


2 Answers

First, it depends on if a window is in background or in foreground. Windows in foreground have a bigger shadow compared to windows in the background.

For foreground windows you could try the following values:

  • Color: black
  • X-Offset: 0
  • Y-Offset: 4 pixels (downwards)
  • Opacity: 100%
  • Radius/Blur: 20 pixels
like image 173
BastiBen Avatar answered Nov 17 '22 11:11

BastiBen


A word of warning: the window shadow values have changed before (from Leopard to Snow Leopard), so hardcoding values will likely end up looking off in future OS versions.

like image 44
Catfish_Man Avatar answered Nov 17 '22 11:11

Catfish_Man