Fix About panel in macOS 10.14 + Dark Mode

This commit is contained in:
1024jp 2020-05-31 17:39:49 +09:00
parent 2e19abf024
commit 2d7b5e4b0b
2 changed files with 7 additions and 0 deletions

View File

@ -13,6 +13,7 @@ Change Log
### Fixes
- Fix an issue in the find panel fields that carriage retturns (CR) were not drawn as line endings but conrol characters.
- Fix an issue under macOS 10.14 that the text in the About panel was black even in the Dark Mode.

View File

@ -304,6 +304,12 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
}
#endif
// backward compatibility for macOS 10.14 that does not support `-apple-system*` colors (macOS 10.15)
if NSAppKitVersion.current < .macOS10_15, #available(macOS 10.14, *), NSApp.effectiveAppearance.isDark {
html = html.replacingOccurrences(of: "<body>", with: "<body style=\"color: hsla(0,0%,100%,.85)\">")
html = html.replacingOccurrences(of: "<h2>", with: "<h2 style=\"color: hsla(0,0%,100%,.55)\">")
}
let attrString = NSAttributedString(html: html.data(using: .utf8)!, baseURL: creditsURL, documentAttributes: nil)!
NSApplication.shared.orderFrontStandardAboutPanel(options: [.credits: attrString])
}