<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSColor/shadow(withLevel:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSColor(im)shadowWithLevel:"
  },
  "title" : "shadow(withLevel:)"
}
-->

# shadow(withLevel:)

Creates a new color object that represents a blend between the current color and the shadow color.

```
func shadow(withLevel val: CGFloat) -> NSColor?
```

## Parameters

`val`

The amount of the shadow color used for the blend. This should be a number from `0.0` through `1.0`.  A `shadowLevel` below `0.0` is interpreted as `0.0`; a `shadowLevel` above `1.0` is interpreted as `1.0`.

## Return Value

The new `NSColor` object. Returns `nil` if the colors can’t be converted.

## Discussion

The shadow color is provided by the [`shadowColor`](/documentation/AppKit/NSColor/shadowColor) property. Call this method when you want to darken the current color for use in shadows.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)