---
title: "changeDocumentBackgroundColor(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextview/changedocumentbackgroundcolor(_:)"
---

# changeDocumentBackgroundColor(_:)

An action method used to set the background color.

## Declaration

```swift
func changeDocumentBackgroundColor(_ sender: Any?)
```

## Parameters

- `sender`: The control that wants to set the background color.

## Discussion

Discussion This method gets the new color by sending a color message to  sender. This will only set the background color if allowsDocumentBackgroundColorChangereturns true.

## See Also

### Setting graphics attributes

- [backgroundColor](appkit/nstextview/backgroundcolor.md)
- [drawsBackground](appkit/nstextview/drawsbackground.md)
- [allowsDocumentBackgroundColorChange](appkit/nstextview/allowsdocumentbackgroundcolorchange.md)
