fix: About Panel credits should be dark mode aware (#21880)
This commit is contained in:
parent
5d1a9c0cbb
commit
55ccca922d
2 changed files with 14 additions and 6 deletions
|
@ -1191,8 +1191,9 @@ Show the app's about panel options. These options can be overridden with `app.se
|
|||
* `website` String (optional) _Linux_ - The app's website.
|
||||
* `iconPath` String (optional) _Linux_ _Windows_ - Path to the app's icon. On Linux, will be shown as 64x64 pixels while retaining aspect ratio.
|
||||
|
||||
Set the about panel options. This will override the values defined in the app's
|
||||
`.plist` file on MacOS. See the [Apple docs][about-panel-options] for more details. On Linux, values must be set in order to be shown; there are no defaults.
|
||||
Set the about panel options. This will override the values defined in the app's `.plist` file on MacOS. See the [Apple docs][about-panel-options] for more details. On Linux, values must be set in order to be shown; there are no defaults.
|
||||
|
||||
If you do not set `credits` but still wish to surface them in your app, AppKit will look for a file named "Credits.html", "Credits.rtf", and "Credits.rtfd", in that order, in the bundle returned by the NSBundle class method main. The first file found is used, and if none is found, the info area is left blank. See Apple [documentation](https://developer.apple.com/documentation/appkit/nsaboutpaneloptioncredits?language=objc) for more information.
|
||||
|
||||
### `app.isEmojiPanelSupported()`
|
||||
|
||||
|
|
|
@ -377,11 +377,18 @@ void Browser::ShowAboutPanel() {
|
|||
NSDictionary* options = DictionaryValueToNSDictionary(about_panel_options_);
|
||||
|
||||
// Credits must be a NSAttributedString instead of NSString
|
||||
id credits = options[@"Credits"];
|
||||
NSString* credits = (NSString*)options[@"Credits"];
|
||||
if (credits != nil) {
|
||||
NSMutableDictionary* mutable_options = [options mutableCopy];
|
||||
mutable_options[@"Credits"] = [[[NSAttributedString alloc]
|
||||
initWithString:(NSString*)credits] autorelease];
|
||||
base::scoped_nsobject<NSMutableDictionary> mutable_options(
|
||||
[options mutableCopy]);
|
||||
base::scoped_nsobject<NSAttributedString> creditString(
|
||||
[[NSAttributedString alloc]
|
||||
initWithString:credits
|
||||
attributes:@{
|
||||
NSForegroundColorAttributeName : [NSColor textColor]
|
||||
}]);
|
||||
|
||||
[mutable_options setValue:creditString forKey:@"Credits"];
|
||||
options = [NSDictionary dictionaryWithDictionary:mutable_options];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue