Matej Bukovinski
Matej Bukovinski

Reputation: 6152

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.

Upvotes: 7

Views: 448

Answers (2)

Catfish_Man
Catfish_Man

Reputation: 41801

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.

Upvotes: 3

BastiBen
BastiBen

Reputation: 19860

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

Upvotes: 4

Related Questions