---
title: "shadow(withLevel:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscolor/shadow(withlevel:)"
---

# shadow(withLevel:)

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

## Declaration

```swift
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

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

## Discussion

Discussion The shadow color is provided by the shadowColor property. Call this method when you want to darken the current color for use in shadows.

## See Also

### Transforming existing color objects

- [usingColorSpace(_:)](appkit/nscolor/usingcolorspace(_:).md)
- [blended(withFraction:of:)](appkit/nscolor/blended(withfraction:of:).md)
- [withAlphaComponent(_:)](appkit/nscolor/withalphacomponent(_:).md)
- [highlight(withLevel:)](appkit/nscolor/highlight(withlevel:).md)
