title: How do I change the color of an SF Symbols based UIButton embedded in a UIAction?
body: <p>I'm generating a button with the following code but am unable to successfully change the button's foreground color.</p>
  <pre><code>let button = UIButton(
      type: .close,
      primaryAction: UIAction(
          image: UIImage(systemName: &quot;x.circle&quot;),
          handler: { _ in }
      )
  )
  </code></pre>
  <p>I've tried</p>
  <ul>
  <li><p><code>UIImage(systemName: &quot;x.circle&quot;)?.withTintColor(.red)</code></p>
  </li>
  <li><p><code>UIImage(systemName: &quot;x.circle&quot;)?.withTintColor(.systemRed, renderingMode: .alwaysOriginal)</code></p>
  </li>
  <li><p><code>button.setTitleColor(.systemRed, for: .normal)</code></p>
  </li>
  <li><p>Adding a configuration:</p>
  <pre><code>var config = UIButton.Configuration.borderless()
  config.baseForegroundColor = .systemRed
  button.configuration = config
  </code></pre>
  </li>
  <li><p>Using a different symbol variant like: <code>UIImage(systemName: &quot;x.circle.fill&quot;)</code></p>
  </li>
  </ul>
  <p>In this specific scenario I want to change the color of the circular background area of the image only and not the X (crosses) or the button's background. Essentially I want a red filled circle with a gray X (crosses).</p>
  <p>So I can get this:
  <a href="https://i.stack.imgur.com/aAMs8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aAMs8.png" alt="enter image description here" /></a></p>
  <p>But I want something more like this (with the red limited to inside the circle):
  <a href="https://i.stack.imgur.com/11D0S.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/11D0S.png" alt="enter image description here" /></a></p>