title: NSAttributedString initialised from HTML dark mode, how to set default foreground color?
body: <p>While converting an existing app to dark mode I stumbled across an initialisation of an <code>UITextView</code> with an <code>NSAttributedString</code> to supply the fine print for some app store legalese. This looks fine in light mode, but in dark mode I get black text on black. My first idea to supply a default foreground color was to add this:</p>
  
  <pre><code>import UIKit
  
  let fgColor: UIColor
  if #available(iOS 13.0, *) {
      fgColor = .label
  } else {
      fgColor = .black
  }
  let s = try NSAttributedString(data: NSLocalizedString("""
          &lt;p style="text-align: center; font-size: smaller;"&gt;
          Your payment will be charged to your iTunes Account at confirmation of purchase. Your subscription automatically renews unless auto-renew is turned off at least 24-hours before the end of the current period. Your Account will be charged for renewal within 24-hours prior to the end of the current period at the same price as the original subscription.
          &lt;/p&gt;
          &lt;p style="text-align: center; font-weight: bold; font-size: smaller;"&gt;
          &lt;a href="https://www.example.com/tos.html"&gt;Terms of Service&lt;/a&gt;&amp;nbsp;&amp;vert;&amp;nbsp;&lt;a href="https://www.example.com/policy.html"&gt;Privacy Policy&lt;/a&gt;
          &lt;/p&gt;
  """, comment: "legalese").data(using: String.Encoding.utf8, allowLossyConversion: false)!,
                                 options: [.documentType: NSAttributedString.DocumentType.html.rawValue,
                                           .defaultAttributes: [NSAttributedString.Key.foregroundColor: fgColor]],
                                 documentAttributes: nil)
  </code></pre>
  
  <p>But whatever I tried, I can not change the default foreground color. Any ideas?</p>