mirror of
https://github.com/SoPat712/YTLitePlus.git
synced 2025-08-22 02:38:45 -04:00
2
Header.h
2
Header.h
@@ -129,6 +129,8 @@
|
||||
@end
|
||||
|
||||
@interface _ASDisplayView : UIView
|
||||
- (UILabel *)findLabelInSubviews:(NSArray *)subviews;
|
||||
- (void)customizeLabel:(UILabel *)label;
|
||||
@end
|
||||
|
||||
@interface YTCommentDetailHeaderCell : UIView
|
||||
|
@@ -38,7 +38,7 @@ static BOOL pinkContrastMode() {
|
||||
return IsEnabled(@"lowContrastMode_enabled") && colorContrastMode() == 8;
|
||||
}
|
||||
|
||||
%group gLowContrastMode // Low Contrast Mode v1.3.0 (Compatible with only v15.02.1-present)
|
||||
%group gLowContrastMode // Low Contrast Mode v1.3.1 (Compatible with only YouTube v16.05.7-v17.38.10)
|
||||
%hook UIColor
|
||||
+ (UIColor *)whiteColor { // Dark Theme Color
|
||||
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
|
||||
@@ -47,7 +47,6 @@ static BOOL pinkContrastMode() {
|
||||
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
|
||||
}
|
||||
%end
|
||||
|
||||
%hook UILabel
|
||||
+ (void)load {
|
||||
@autoreleasepool {
|
||||
@@ -55,7 +54,6 @@ static BOOL pinkContrastMode() {
|
||||
}
|
||||
}
|
||||
%end
|
||||
|
||||
%hook YTCommonColorPalette
|
||||
- (UIColor *)textPrimary {
|
||||
if (self.pageStyle == 1) {
|
||||
@@ -70,49 +68,40 @@ static BOOL pinkContrastMode() {
|
||||
return [UIColor colorWithRed: 0.38 green: 0.38 blue: 0.38 alpha: 1.00]; // Light Theme
|
||||
}
|
||||
%end
|
||||
|
||||
%hook YTCollectionView
|
||||
- (void)setTintColor:(UIColor *)color {
|
||||
return isDarkMode() ? %orig([UIColor whiteColor]) : %orig;
|
||||
}
|
||||
%end
|
||||
|
||||
%hook LOTAnimationView
|
||||
- (void) setTintColor:(UIColor *)tintColor {
|
||||
tintColor = [UIColor whiteColor];
|
||||
%orig(tintColor);
|
||||
}
|
||||
%end
|
||||
|
||||
%hook ASTextNode
|
||||
- (NSAttributedString *)attributedString {
|
||||
NSAttributedString *originalAttributedString = %orig;
|
||||
|
||||
NSMutableAttributedString *newAttributedString = [originalAttributedString mutableCopy];
|
||||
[newAttributedString addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0, newAttributedString.length)];
|
||||
|
||||
return newAttributedString;
|
||||
}
|
||||
%end
|
||||
|
||||
%hook ASTextFieldNode
|
||||
- (void)setTextColor:(UIColor *)textColor {
|
||||
%orig([UIColor whiteColor]);
|
||||
}
|
||||
%end
|
||||
|
||||
%hook ASTextView
|
||||
- (void)setTextColor:(UIColor *)textColor {
|
||||
%orig([UIColor whiteColor]);
|
||||
}
|
||||
%end
|
||||
|
||||
%hook ASButtonNode
|
||||
- (void)setTextColor:(UIColor *)textColor {
|
||||
%orig([UIColor whiteColor]);
|
||||
}
|
||||
%end
|
||||
|
||||
%hook UIButton
|
||||
- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state {
|
||||
%log;
|
||||
@@ -120,7 +109,13 @@ static BOOL pinkContrastMode() {
|
||||
%orig(color, state);
|
||||
}
|
||||
%end
|
||||
|
||||
%hook UIBarButtonItem
|
||||
- (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state {
|
||||
NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attributes];
|
||||
[modifiedAttributes setObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName];
|
||||
%orig(modifiedAttributes, state);
|
||||
}
|
||||
%end
|
||||
%hook UILabel
|
||||
- (void)setTextColor:(UIColor *)textColor {
|
||||
%log;
|
||||
@@ -128,7 +123,6 @@ static BOOL pinkContrastMode() {
|
||||
%orig(textColor);
|
||||
}
|
||||
%end
|
||||
|
||||
%hook UITextField
|
||||
- (void)setTextColor:(UIColor *)textColor {
|
||||
%log;
|
||||
@@ -136,7 +130,6 @@ static BOOL pinkContrastMode() {
|
||||
%orig(textColor);
|
||||
}
|
||||
%end
|
||||
|
||||
%hook UITextView
|
||||
- (void)setTextColor:(UIColor *)textColor {
|
||||
%log;
|
||||
@@ -144,17 +137,47 @@ static BOOL pinkContrastMode() {
|
||||
%orig(textColor);
|
||||
}
|
||||
%end
|
||||
|
||||
%hook UISearchBar
|
||||
- (void)setTextColor:(UIColor *)textColor {
|
||||
textColor = [UIColor whiteColor];
|
||||
%orig(textColor);
|
||||
}
|
||||
%end
|
||||
%hook UISegmentedControl
|
||||
- (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state {
|
||||
NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attributes];
|
||||
[modifiedAttributes setObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName];
|
||||
%orig(modifiedAttributes, state);
|
||||
}
|
||||
%end
|
||||
%hook VideoTitleLabel
|
||||
- (void)setTextColor:(UIColor *)textColor {
|
||||
textColor = [UIColor whiteColor];
|
||||
%orig(textColor);
|
||||
}
|
||||
%end
|
||||
|
||||
%hook _ASDisplayView
|
||||
- (UIColor *)textColor {
|
||||
return [UIColor whiteColor];
|
||||
- (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;
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
- (void)customizeLabel:(UILabel *)label {
|
||||
label.textColor = [UIColor whiteColor];
|
||||
}
|
||||
%end
|
||||
%end
|
||||
|
Reference in New Issue
Block a user