Update LowContrastMode.xm

This commit is contained in:
arichornlover 2023-12-13 03:29:39 -06:00 committed by GitHub
parent e1d4228ae0
commit 0b44e9c646
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -174,11 +174,14 @@ UIColor *lcmHexColor;
%hook ELMTextNode
- (void)updateAttributedText {
%orig;
NSMutableDictionary *attributes = [[self.attributedText attributesAtIndex:0 effectiveRange:NULL] mutableCopy];
attributes[NSForegroundColorAttributeName] = [UIColor whiteColor];
NSMutableAttributedString *modifiedText = [[NSMutableAttributedString alloc] initWithAttributedString:self.attributedText];
[modifiedText setAttributes:attributes range:NSMakeRange(0, modifiedText.length)];
self.attributedText = modifiedText;
UILabel *label = nil;
for (UIView *subview in self.subviews) {
if ([subview isKindOfClass:[UILabel class]]) {
label = (UILabel *)subview;
break;
}
}
label.textColor = [UIColor whiteColor];
}
%end
%hook YCHLiveChatLabel
@ -285,6 +288,18 @@ UIColor *lcmHexColor;
}
%end
%hook ASTextNode
- (void)setAttributedText:(NSAttributedString *)attributedText {
%orig;
NSMutableDictionary *attributes = [attributedText attributesAtIndex:0 effectiveRange:NULL].mutableCopy;
attributes[NSForegroundColorAttributeName] = [UIColor whiteColor];
NSMutableAttributedString *modifiedText = [[NSMutableAttributedString alloc] initWithAttributedString:attributedText];
[modifiedText setAttributes:attributes range:NSMakeRange(0, modifiedText.length)];
[self setAttributedText:modifiedText];
}
- (void)tintColorDidChange {
%orig;
self.textColorFollowsTintColor = NO;
}
- (NSAttributedString *)attributedString {
NSAttributedString *originalAttributedString = %orig;
NSMutableAttributedString *newAttributedString = [originalAttributedString mutableCopy];