mirror of
				https://github.com/SoPat712/YTLitePlus.git
				synced 2025-10-30 20:34:04 -04:00 
			
		
		
		
	Update LowContrastMode.xm
This commit is contained in:
		| @@ -38,7 +38,7 @@ static BOOL pinkContrastMode() { | |||||||
|     return IsEnabled(@"lowContrastMode_enabled") && colorContrastMode() == 8; |     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 | %hook UIColor | ||||||
| + (UIColor *)whiteColor { // Dark Theme Color | + (UIColor *)whiteColor { // Dark Theme Color | ||||||
|          return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00]; |          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]; |          return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00]; | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook UILabel | %hook UILabel | ||||||
| + (void)load { | + (void)load { | ||||||
|     @autoreleasepool { |     @autoreleasepool { | ||||||
| @@ -55,7 +54,6 @@ static BOOL pinkContrastMode() { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook YTCommonColorPalette | %hook YTCommonColorPalette | ||||||
| - (UIColor *)textPrimary { | - (UIColor *)textPrimary { | ||||||
|     if (self.pageStyle == 1) { |     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 |         return [UIColor colorWithRed: 0.38 green: 0.38 blue: 0.38 alpha: 1.00]; // Light Theme | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook YTCollectionView | %hook YTCollectionView | ||||||
|  - (void)setTintColor:(UIColor *)color {  |  - (void)setTintColor:(UIColor *)color {  | ||||||
|      return isDarkMode() ? %orig([UIColor whiteColor]) : %orig; |      return isDarkMode() ? %orig([UIColor whiteColor]) : %orig; | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook LOTAnimationView | %hook LOTAnimationView | ||||||
| - (void) setTintColor:(UIColor *)tintColor { | - (void) setTintColor:(UIColor *)tintColor { | ||||||
|     tintColor = [UIColor whiteColor]; |     tintColor = [UIColor whiteColor]; | ||||||
|     %orig(tintColor); |     %orig(tintColor); | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook ASTextNode | %hook ASTextNode | ||||||
| - (NSAttributedString *)attributedString { | - (NSAttributedString *)attributedString { | ||||||
|     NSAttributedString *originalAttributedString = %orig; |     NSAttributedString *originalAttributedString = %orig; | ||||||
|  |  | ||||||
|     NSMutableAttributedString *newAttributedString = [originalAttributedString mutableCopy]; |     NSMutableAttributedString *newAttributedString = [originalAttributedString mutableCopy]; | ||||||
|     [newAttributedString addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0, newAttributedString.length)]; |     [newAttributedString addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0, newAttributedString.length)]; | ||||||
|  |  | ||||||
|     return newAttributedString; |     return newAttributedString; | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook ASTextFieldNode | %hook ASTextFieldNode | ||||||
| - (void)setTextColor:(UIColor *)textColor { | - (void)setTextColor:(UIColor *)textColor { | ||||||
|    %orig([UIColor whiteColor]); |    %orig([UIColor whiteColor]); | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook ASTextView | %hook ASTextView | ||||||
| - (void)setTextColor:(UIColor *)textColor { | - (void)setTextColor:(UIColor *)textColor { | ||||||
|    %orig([UIColor whiteColor]); |    %orig([UIColor whiteColor]); | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook ASButtonNode | %hook ASButtonNode | ||||||
| - (void)setTextColor:(UIColor *)textColor { | - (void)setTextColor:(UIColor *)textColor { | ||||||
|    %orig([UIColor whiteColor]); |    %orig([UIColor whiteColor]); | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook UIButton  | %hook UIButton  | ||||||
| - (void)setTitleColor:(UIColor *)color forState:(UIControlState)state { | - (void)setTitleColor:(UIColor *)color forState:(UIControlState)state { | ||||||
|     %log; |     %log; | ||||||
| @@ -120,7 +109,13 @@ static BOOL pinkContrastMode() { | |||||||
|     %orig(color, state); |     %orig(color, state); | ||||||
| } | } | ||||||
| %end | %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 | %hook UILabel | ||||||
| - (void)setTextColor:(UIColor *)textColor { | - (void)setTextColor:(UIColor *)textColor { | ||||||
|     %log; |     %log; | ||||||
| @@ -128,7 +123,6 @@ static BOOL pinkContrastMode() { | |||||||
|     %orig(textColor); |     %orig(textColor); | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook UITextField | %hook UITextField | ||||||
| - (void)setTextColor:(UIColor *)textColor { | - (void)setTextColor:(UIColor *)textColor { | ||||||
|     %log; |     %log; | ||||||
| @@ -136,7 +130,6 @@ static BOOL pinkContrastMode() { | |||||||
|     %orig(textColor); |     %orig(textColor); | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook UITextView | %hook UITextView | ||||||
| - (void)setTextColor:(UIColor *)textColor { | - (void)setTextColor:(UIColor *)textColor { | ||||||
|     %log; |     %log; | ||||||
| @@ -144,17 +137,47 @@ static BOOL pinkContrastMode() { | |||||||
|     %orig(textColor); |     %orig(textColor); | ||||||
| } | } | ||||||
| %end | %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 | %hook VideoTitleLabel | ||||||
| - (void)setTextColor:(UIColor *)textColor { | - (void)setTextColor:(UIColor *)textColor { | ||||||
|     textColor = [UIColor whiteColor]; |     textColor = [UIColor whiteColor]; | ||||||
|     %orig(textColor); |     %orig(textColor); | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook _ASDisplayView | %hook _ASDisplayView | ||||||
| - (UIColor *)textColor { | - (void)didMoveToWindow { | ||||||
|          return [UIColor whiteColor]; |     %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 | ||||||
| %end | %end | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 arichorn
					arichorn