File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -187,10 +187,20 @@ - (UIMenuElement*) createMenuElementForAction:(ContextMenuAction *)action atInde
187
187
UIImage *iconImage = nil ;
188
188
189
189
if (action.icon != nil ) {
190
- UIColor *iconColor = [UIColor blackColor ] ;
190
+ UIColor *iconColor;
191
191
192
192
if (action.iconColor != nil ) {
193
193
iconColor = action.iconColor ;
194
+ } else {
195
+ // Default color depends on dark mode
196
+ if (@available (iOS 13.0 , *)) {
197
+ UIUserInterfaceStyle currentStyle = [UITraitCollection currentTraitCollection ].userInterfaceStyle ;
198
+ iconColor = (currentStyle == UIUserInterfaceStyleDark) ? [UIColor whiteColor ] : [UIColor blackColor ];
199
+ }
200
+ // Fallback for iOS < 13
201
+ else {
202
+ iconColor = [UIColor blackColor ];
203
+ }
194
204
}
195
205
// Use custom icon from Assets.xcassets
196
206
iconImage = [[UIImage imageNamed: action.icon] imageWithTintColor: iconColor];
You can’t perform that action at this time.
0 commit comments