<!--
{
  "availability" : [
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "InputMethodKit",
  "identifier" : "/documentation/InputMethodKit/IMKCandidates/setAttributes(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "InputMethodKit"
    ],
    "preciseIdentifier" : "c:objc(cs)IMKCandidates(im)setAttributes:"
  },
  "title" : "setAttributes(_:)"
}
-->

# setAttributes(_:)

Sets the style attributes for the candidates window.

```
func setAttributes(_ attributes: [AnyHashable : Any]!)
```

## Parameters

`attributes`

A dictionary that contains keys and values for the styles to use. You can supply the keys and values listed in the following table:
    
    |Key                               |Value                                                                                                                                                                                                                                          |
    |----------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
    |NSFontAttributeName               |An `NSFont` object. Setting the font attribute sets the font that is used to draw Candidates. It does not effect the selection keys which are always drawn in the same font. Note that to set the font size you should use this key/value pair.|
    |IMKCandidatesOpacityAttributeName |An `NSNumber` object that represents a floating-point value between `0.0` (transparent) and `1.0` (completely opaque. The default opacity is `1.0`.                                                                                            |
    |NSForegroundColorAttributeName    |An `NSColor` object to use for the candidate text color. The default color is black.                                                                                                                                                           |
    |NSBackgroundColorDocumentAttribute|An `NSColor` object to use for the background color  behind the candidate text.                                                                                                                                                                |

---

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)