mirror of
				https://github.com/SoPat712/YTLitePlus.git
				synced 2025-10-30 12:23:58 -04:00 
			
		
		
		
	Testing new OldDarkMode (just cloned OLED and changed color value)
This commit is contained in:
		
							
								
								
									
										284
									
								
								Source/Themes.xm
									
									
									
									
									
								
							
							
						
						
									
										284
									
								
								Source/Themes.xm
									
									
									
									
									
								
							| @@ -16,85 +16,315 @@ static BOOL oldDarkTheme() { | |||||||
| // Themes.xm - Theme Options | // Themes.xm - Theme Options | ||||||
| // Old dark theme (gray) | // Old dark theme (gray) | ||||||
| %group gOldDarkTheme | %group gOldDarkTheme | ||||||
| %hook YTAsyncCollectionView | UIColor *customColor = [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0]; | ||||||
| - (UIColor *)backgroundColor:(NSInteger)pageStyle { | %hook YTCommonColorPalette | ||||||
|     return pageStyle == 1 ? [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0] : %orig; | - (UIColor *)brandBackgroundSolid { | ||||||
|  |     return self.pageStyle == 1 ? customColor : %orig; | ||||||
| } | } | ||||||
| - (UIColor *)darkBackgroundColor { | - (UIColor *)brandBackgroundPrimary { | ||||||
|          return [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0]; |     return self.pageStyle == 1 ? customColor : %orig; | ||||||
|  | } | ||||||
|  | - (UIColor *)brandBackgroundSecondary { | ||||||
|  |     return self.pageStyle == 1 ? [customColor colorWithAlphaComponent:0.9] : %orig; | ||||||
|  | } | ||||||
|  | - (UIColor *)raisedBackground { | ||||||
|  |     return self.pageStyle == 1 ? customColor : %orig; | ||||||
|  | } | ||||||
|  | - (UIColor *)staticBrandBlack { | ||||||
|  |     return self.pageStyle == 1 ? customColor : %orig; | ||||||
|  | } | ||||||
|  | - (UIColor *)generalBackgroundA { | ||||||
|  |     return self.pageStyle == 1 ? customColor : %orig; | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook YTAppView | %hook YTAppView | ||||||
| - (void)setBackgroundColor:(UIColor *)color { | - (UIColor *)backgroundColor:(NSInteger)pageStyle { | ||||||
|     %orig([UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0]); |     return pageStyle == 1 ? customColor : %orig; | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook YTPivotBarView | %hook YTPivotBarView | ||||||
| - (void)setBackgroundColor:(UIColor *)color { | - (UIColor *)backgroundColor:(NSInteger)pageStyle { | ||||||
|     %orig([UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0]); |     return pageStyle == 1 ? customColor : %orig; | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook YTAsyncCollectionView | %hook YTAsyncCollectionView | ||||||
| - (void)setBackgroundColor:(UIColor *)color { | - (UIColor *)backgroundColor:(NSInteger)pageStyle { | ||||||
|     %orig([UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0]); |     return pageStyle == 1 ? customColor : %orig; | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook YTAppViewController | %hook YTAppViewController | ||||||
| - (UIColor *)backgroundColor:(NSInteger)pageStyle { | - (UIColor *)backgroundColor:(NSInteger)pageStyle { | ||||||
|     return pageStyle == 1 ? [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0] : %orig; |     return pageStyle == 1 ? customColor : %orig; | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook YTNavigationBar | %hook YTNavigationBar | ||||||
| - (UIColor *)backgroundColor:(NSInteger)pageStyle { | - (UIColor *)backgroundColor:(NSInteger)pageStyle { | ||||||
|     return pageStyle == 1 ? [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0] : %orig; |     return pageStyle == 1 ? customColor : %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | BOOL areColorsEqual(UIColor *color1, UIColor *color2, CGFloat tolerance) { | ||||||
|  |     CGFloat r1, g1, b1, a1, r2, g2, b2, a2; | ||||||
|  |     [color1 getRed:&r1 green:&g1 blue:&b1 alpha:&a1]; | ||||||
|  |     [color2 getRed:&r2 green:&g2 blue:&b2 alpha:&a2]; | ||||||
|  |  | ||||||
|  |     return (fabs(r1 - r2) <= tolerance) && | ||||||
|  |            (fabs(g1 - g2) <= tolerance) && | ||||||
|  |            (fabs(b1 - b2) <= tolerance) && | ||||||
|  |            (fabs(a1 - a2) <= tolerance); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | %hook UIView | ||||||
|  | - (void)setBackgroundColor:(UIColor *)color { | ||||||
|  |     UIColor *targetColor = [UIColor colorWithRed:0.0588235 green:0.0588235 blue:0.0588235 alpha:1]; | ||||||
|  |     CGFloat tolerance = 0.01; // Adjust this value as needed | ||||||
|  |  | ||||||
|  |     if (areColorsEqual(color, targetColor, tolerance)) { | ||||||
|  |         color = customColor; | ||||||
|  |     } | ||||||
|  |     %orig(color); | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | %hook YTCollectionViewController | ||||||
|  | - (UIColor *)backgroundColor:(NSInteger)pageStyle { | ||||||
|  |     return pageStyle == 1 ? customColor : %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | %hook YTChannelMobileHeaderViewController | ||||||
|  | - (UIColor *)backgroundColor:(NSInteger)pageStyle { | ||||||
|  |     return pageStyle == 1 ? customColor : %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | %hook YTELMView | ||||||
|  | - (UIColor *)backgroundColor:(NSInteger)pageStyle { | ||||||
|  |     return pageStyle == 1 ? customColor : %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | %hook YTHeaderViewController | ||||||
|  | - (UIColor *)backgroundColor:(NSInteger)pageStyle { | ||||||
|  |     return pageStyle == 1 ? customColor : %orig; | ||||||
|  | } | ||||||
|  | - (UIColor *)barTintColor:(NSInteger)pageStyle { | ||||||
|  |     return pageStyle == 1 ? customColor : %orig; | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook YTInnerTubeCollectionViewController | %hook YTInnerTubeCollectionViewController | ||||||
| - (UIColor *)backgroundColor:(NSInteger)pageStyle { | - (UIColor *)backgroundColor:(NSInteger)pageStyle { | ||||||
|     return pageStyle == 1 ? [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0] : %orig; |     return pageStyle == 1 ? customColor : %orig; | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook YTColdConfig | %hook YTSettingsCell | ||||||
| - (BOOL)uiSystemsClientGlobalConfigUseDarkerPaletteBgColorForNative { return NO; } | - (UIColor *)backgroundColor:(NSInteger)pageStyle { | ||||||
| - (BOOL)uiSystemsClientGlobalConfigUseDarkerPaletteTextColorForNative { return NO; } |     return pageStyle == 1 ? customColor : %orig; | ||||||
| - (BOOL)enableCinematicContainerOnClient { return NO; } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook _ASDisplayView | %hook YTSearchViewController | ||||||
|  | - (UIColor *)backgroundColor:(NSInteger)pageStyle { | ||||||
|  |     return pageStyle == 1 ? customColor : %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | %hook YTSectionListViewController | ||||||
|  | - (UIColor *)backgroundColor:(NSInteger)pageStyle { | ||||||
|  |     return pageStyle == 1 ? customColor : %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | %hook YTWatchMiniBarViewController | ||||||
|  | - (UIColor *)backgroundColor:(NSInteger)pageStyle { | ||||||
|  |     return pageStyle == 1 ? customColor : %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | %hook YTWrapperSplitViewController | ||||||
|  | - (UIColor *)backgroundColor:(NSInteger)pageStyle { | ||||||
|  |     return pageStyle == 1 ? customColor : %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | // Explore | ||||||
|  | %hook ASScrollView  | ||||||
| - (void)didMoveToWindow { | - (void)didMoveToWindow { | ||||||
|     %orig; |     %orig; | ||||||
|     if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.comment_composer"]) { self.backgroundColor = [UIColor clearColor]; } |     if (isDarkMode()) { | ||||||
|     if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.video_list_entry"]) { self.backgroundColor = [UIColor clearColor]; } |         self.backgroundColor = [UIColor clearColor]; | ||||||
|  |     } | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
|  | // Your videos | ||||||
| %hook ASCollectionView | %hook ASCollectionView | ||||||
| - (void)didMoveToWindow { | - (void)didMoveToWindow { | ||||||
|     %orig; |     %orig; | ||||||
|     self.superview.backgroundColor = [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0]; |     if (isDarkMode() && [self.nextResponder isKindOfClass:%c(_ASDisplayView)]) { | ||||||
|  |         self.superview.backgroundColor = customColor; | ||||||
|  |     } | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook YTFullscreenEngagementOverlayView | // Sub? | ||||||
|  | %hook ELMView | ||||||
| - (void)didMoveToWindow { | - (void)didMoveToWindow { | ||||||
|     %orig; |     %orig; | ||||||
|     self.subviews[0].backgroundColor = [UIColor clearColor]; |     if (isDarkMode()) { | ||||||
|  |         self.subviews[0].backgroundColor = customColor; | ||||||
|  |     } | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| %hook YTRelatedVideosView | // iSponsorBlock | ||||||
| - (void)didMoveToWindow { | %hook SponsorBlockSettingsController | ||||||
|  | - (void)viewDidLoad { | ||||||
|  |     if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) { | ||||||
|         %orig; |         %orig; | ||||||
|     self.subviews[0].backgroundColor = [UIColor clearColor]; |         self.tableView.backgroundColor = customColor; | ||||||
|  |     } else { return %orig; } | ||||||
| } | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
|  | %hook SponsorBlockViewController | ||||||
|  | - (void)viewDidLoad { | ||||||
|  |     if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) { | ||||||
|  |         %orig; | ||||||
|  |         self.view.backgroundColor = customColor; | ||||||
|  |     } else { return %orig; } | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | // Search View | ||||||
|  | %hook YTSearchBarView  | ||||||
|  | - (void)setBackgroundColor:(UIColor *)color { | ||||||
|  |     return isDarkMode() ? %orig(customColor) : %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | // History Search view | ||||||
|  | %hook YTSearchBoxView  | ||||||
|  | - (void)setBackgroundColor:(UIColor *)color { | ||||||
|  |     return isDarkMode() ? %orig(customColor) : %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | // Comment view | ||||||
|  | %hook YTCommentView | ||||||
|  | - (void)setBackgroundColor:(UIColor *)color { | ||||||
|  |     return isDarkMode() ? %orig(customColor) : %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | %hook YTCreateCommentAccessoryView | ||||||
|  | - (void)setBackgroundColor:(UIColor *)color { | ||||||
|  |     return isDarkMode() ? %orig(customColor) : %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | %hook YTCreateCommentTextView | ||||||
|  | - (void)setBackgroundColor:(UIColor *)color { | ||||||
|  |     return isDarkMode() ? %orig(customColor) : %orig; | ||||||
|  | } | ||||||
|  | - (void)setTextColor:(UIColor *)color { // fix black text in #Shorts video's comment | ||||||
|  |     return isDarkMode() ? %orig([UIColor whiteColor]) : %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | %hook YTCommentDetailHeaderCell | ||||||
|  | - (void)didMoveToWindow { | ||||||
|  |     %orig; | ||||||
|  |     if (isDarkMode()) { | ||||||
|  |         self.subviews[2].backgroundColor = customColor; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | %hook YTFormattedStringLabel  // YT is werid... | ||||||
|  | - (void)setBackgroundColor:(UIColor *)color { | ||||||
|  |     return isDarkMode() ? %orig([UIColor clearColor]) : %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | // Live chat comment | ||||||
|  | %hook YCHLiveChatActionPanelView  | ||||||
|  | - (void)setBackgroundColor:(UIColor *)color { | ||||||
|  |     return isDarkMode() ? %orig(customColor) : %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | %hook YTEmojiTextView | ||||||
|  | - (void)setBackgroundColor:(UIColor *)color { | ||||||
|  |     return isDarkMode() ? %orig(customColor) : %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | %hook YCHLiveChatView | ||||||
|  | - (void)didMoveToWindow { | ||||||
|  |     %orig; | ||||||
|  |     if (isDarkMode()) { | ||||||
|  |         self.subviews[1].backgroundColor = customColor; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | // | ||||||
|  | %hook YTBackstageCreateRepostDetailView | ||||||
|  | - (void)setBackgroundColor:(UIColor *)color { | ||||||
|  |     return isDarkMode() ? %orig(customColor) : %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | // Others | ||||||
|  | %hook _ASDisplayView | ||||||
|  | - (void)didMoveToWindow { | ||||||
|  |     %orig; | ||||||
|  |     if (isDarkMode()) { | ||||||
|  |         if ([self.nextResponder isKindOfClass:%c(ASScrollView)]) { self.backgroundColor = [UIColor clearColor]; } | ||||||
|  |         if ([self.accessibilityIdentifier isEqualToString:@"eml.cvr"]) { self.backgroundColor = customColor; } | ||||||
|  |         if ([self.accessibilityIdentifier isEqualToString:@"rich_header"]) { self.backgroundColor = customColor; } | ||||||
|  |         if ([self.accessibilityIdentifier isEqualToString:@"id.ui.comment_cell"]) { self.backgroundColor = customColor; } | ||||||
|  |         if ([self.accessibilityIdentifier isEqualToString:@"id.ui.cancel.button"]) { self.superview.backgroundColor = [UIColor clearColor]; } | ||||||
|  |         if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.comment_composer"]) { self.backgroundColor = customColor; } | ||||||
|  |         if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.video_list_entry"]) { self.backgroundColor = customColor; } | ||||||
|  |         if ([self.accessibilityIdentifier isEqualToString:@"id.comment.guidelines_text"]) { self.superview.backgroundColor = customColor; } | ||||||
|  |         if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_bottom_sheet_container"]) { self.backgroundColor = customColor; } | ||||||
|  |         if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_entry_banner_container"]) { self.backgroundColor = customColor; } | ||||||
|  | 		if ([self.accessibilityIdentifier isEqualToString:@"id.comment.comment_group_detail_container"]) { self.backgroundColor = [UIColor clearColor]; } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | // Open link with... | ||||||
|  | %hook ASWAppSwitchingSheetHeaderView | ||||||
|  | - (void)setBackgroundColor:(UIColor *)color { | ||||||
|  |     return isDarkMode() ? %orig(raisedColor) : %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | %hook ASWAppSwitchingSheetFooterView | ||||||
|  | - (void)setBackgroundColor:(UIColor *)color { | ||||||
|  |     return isDarkMode() ? %orig(raisedColor) : %orig; | ||||||
|  | } | ||||||
|  | %end | ||||||
|  |  | ||||||
|  | %hook ASWAppSwitcherCollectionViewCell | ||||||
|  | - (void)didMoveToWindow { | ||||||
|  |     %orig; | ||||||
|  |     if (isDarkMode()) { | ||||||
|  |         self.backgroundColor = raisedColor; | ||||||
|  |         self.subviews[1].backgroundColor = raisedColor; | ||||||
|  |         self.superview.backgroundColor = raisedColor; | ||||||
|  |     } | ||||||
|  | } | ||||||
| %end | %end | ||||||
|  |  | ||||||
| // OLED dark mode by BandarHL | // OLED dark mode by BandarHL | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Balackburn
					Balackburn