Update LowContrastMode.xm

This commit is contained in:
arichorn 2023-07-24 06:56:43 -05:00 committed by GitHub
parent f4c800c3cd
commit 1478bb27aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -159,26 +159,21 @@ static BOOL pinkContrastMode() {
%hook _ASDisplayView
- (void)didMoveToWindow {
%orig;
UILabel *label = [self findLabelInSubviews:self.subviews];
if (label) {
[self customizeLabel:label];
}
}
- (UILabel *)findLabelInSubviews:(NSArray *)subviews {
for (UIView *subview in subviews) {
if ([subview isKindOfClass:[UILabel class]]) {
return (UILabel *)subview;
}
UILabel *label = [self findLabelInSubviews:subview.subviews];
if (label) {
return label;
if ([self isKindOfClass:NSClassFromString(@"ASDisplayNode")]) {
UILabel *titleLabel = [self valueForKey:@"accessibilityLabel"];
UIView *superview = [self valueForKey:@"superview"];
if ([titleLabel isKindOfClass:[UILabel class]]) {
titleLabel.textColor = [UIColor whiteColor];
}
if ([superview isKindOfClass:[UIView class]]) {
for (UIView *subview in superview.subviews) {
if ([subview isKindOfClass:[UILabel class]]) {
UILabel *textView = (UILabel *)subview;
textView.textColor = [UIColor whiteColor];
}
}
}
}
return nil;
}
- (void)customizeLabel:(UILabel *)label {
label.textColor = [UIColor whiteColor];
// Add any additional customizations you want for the label here
}
%end
%end