From 22f017205d9480f7dca17edffce7d9e6e44f8b20 Mon Sep 17 00:00:00 2001 From: arichorn <78001398+arichorn@users.noreply.github.com> Date: Thu, 13 Jul 2023 20:20:07 -0500 Subject: [PATCH] Undo OLED & Old Dark Mode changes --- uYouPlus.xm | 472 +++------------------------------------------------- 1 file changed, 23 insertions(+), 449 deletions(-) diff --git a/uYouPlus.xm b/uYouPlus.xm index 142abd3258..6cc81e188f 100644 --- a/uYouPlus.xm +++ b/uYouPlus.xm @@ -829,360 +829,44 @@ static void replaceTab(YTIGuideResponse *response) { // Theme Options // Old dark theme (gray) %group gOldDarkTheme -UIColor *customColor = [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0]; -%hook YTCommonColorPalette -- (UIColor *)brandBackgroundSolid { - return self.pageStyle == 1 ? customColor : %orig; -} -- (UIColor *)brandBackgroundPrimary { - 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 - -%hook YTAppView -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? customColor : %orig; -} -%end - -%hook YTPivotBarView -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? customColor : %orig; -} -%end - -%hook YTAsyncCollectionView -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? customColor : %orig; -} -%end - -%hook YTAppViewController -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? customColor : %orig; -} -%end - -%hook YTNavigationBar -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - 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 *targetColor1 = [UIColor colorWithRed:0.0588235 green:0.0588235 blue:0.0588235 alpha:1]; - UIColor *targetColor2 = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; // Replace with the new target color values - CGFloat tolerance = 0.01; // Adjust this value as needed - - if (areColorsEqual(color, targetColor1, tolerance) || areColorsEqual(color, targetColor2, tolerance)) { - color = customColor; - } - %orig(color); -} -%end - -// Hide separators -%hook YTCollectionSeparatorView -- (void)setHidden:(BOOL)arg1 { - %orig(YES); -} -%end - -// Testing OLED YTPlayerView for OldDarkmode (video background) -%hook YTPlayerView -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? [UIColor blackColor] : %orig; -} -%end - -// Hide broken YTCinematicContainerView -%hook YTCinematicContainerView -- (void)setHidden:(BOOL)arg1 { - %orig(YES); -} -%end - -%hook YTCollectionViewController -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? customColor : %orig; -} -%end - -%hook YTWatchView -- (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; -} +%hook YTColdConfig +- (BOOL)uiSystemsClientGlobalConfigUseDarkerPaletteBgColorForNative { return NO; } +- (BOOL)uiSystemsClientGlobalConfigUseDarkerPaletteTextColorForNative { return NO; } +- (BOOL)enableCinematicContainerOnClient { return NO; } %end %hook _ASDisplayView -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? customColor : %orig; -} -%end - -%hook UIDeviceWhiteColor -- (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 - -%hook YTInnerTubeCollectionViewController -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? customColor : %orig; -} -%end - -%hook YTSettingsCell -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? customColor : %orig; -} -%end - -%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 { %orig; - if (isDarkMode()) { - self.backgroundColor = [UIColor clearColor]; - } + if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.comment_composer"]) { self.backgroundColor = [UIColor clearColor]; } + if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.video_list_entry"]) { self.backgroundColor = [UIColor clearColor]; } } %end -// Your videos %hook ASCollectionView - (void)didMoveToWindow { %orig; - if (isDarkMode() && [self.nextResponder isKindOfClass:%c(_ASDisplayView)]) { - self.superview.backgroundColor = customColor; - } -} -%end - -// Sub? -%hook ELMView -- (void)didMoveToWindow { - %orig; - if (isDarkMode()) { - self.subviews[0].backgroundColor = customColor; - } -} -%end - -// iSponsorBlock -%hook SponsorBlockSettingsController -- (void)viewDidLoad { - if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) { - %orig; - self.tableView.backgroundColor = customColor; - } else { return %orig; } -} -%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; - } + self.superview.backgroundColor = [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0]; } %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 +%hook YTFullscreenEngagementOverlayView - (void)didMoveToWindow { %orig; - if (isDarkMode()) { - self.subviews[1].backgroundColor = customColor; - } + self.subviews[0].backgroundColor = [UIColor clearColor]; } %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(customColor) : %orig; -} -%end - -%hook ASWAppSwitchingSheetFooterView -- (void)setBackgroundColor:(UIColor *)color { - return isDarkMode() ? %orig(customColor) : %orig; -} -%end - -%hook ASWAppSwitcherCollectionViewCell +%hook YTRelatedVideosView - (void)didMoveToWindow { %orig; - if (isDarkMode()) { - self.backgroundColor = customColor; - self.subviews[1].backgroundColor = customColor; - self.superview.backgroundColor = customColor; - } + self.subviews[0].backgroundColor = [UIColor clearColor]; } %end %end // OLED dark mode by BandarHL -UIColor* raisedColor = [UIColor blackColor]; +UIColor* raisedColor = [UIColor colorWithRed:0.035 green:0.035 blue:0.035 alpha:1.0]; %group gOLED %hook YTCommonColorPalette - (UIColor *)brandBackgroundSolid { @@ -1205,130 +889,12 @@ UIColor* raisedColor = [UIColor blackColor]; } %end -%hook YTAppView -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? [UIColor blackColor] : %orig; -} -%end - -%hook YTPivotBarView -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? [UIColor blackColor] : %orig; -} -%end - -%hook YTAsyncCollectionView -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? [UIColor blackColor] : %orig; -} -%end - -%hook YTAppViewController -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? [UIColor blackColor] : %orig; -} -%end - -%hook YTNavigationBar -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? [UIColor blackColor] : %orig; -} -%end - -%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 = [UIColor blackColor]; - } - %orig(color); -} -%end - -%hook YTCollectionViewController -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? [UIColor blackColor] : %orig; -} -%end - -%hook _ASDisplayView -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? [UIColor blackColor] : %orig; -} -%end - -%hook UIDeviceWhiteColor -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? [UIColor blackColor] : %orig; -} -%end - -%hook YTChannelMobileHeaderViewController -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? [UIColor blackColor] : %orig; -} -%end - -// Hide separators -%hook YTCollectionSeparatorView -- (void)setHidden:(BOOL)arg1 { - %orig(YES); -} -%end - -%hook YTELMView -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? [UIColor blackColor] : %orig; -} -%end - -%hook YTHeaderViewController -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? [UIColor blackColor] : %orig; -} -- (UIColor *)barTintColor:(NSInteger)pageStyle { - return pageStyle == 1 ? [UIColor blackColor] : %orig; -} -%end - %hook YTInnerTubeCollectionViewController - (UIColor *)backgroundColor:(NSInteger)pageStyle { return pageStyle == 1 ? [UIColor blackColor] : %orig; } %end -%hook YTSettingsCell -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? [UIColor blackColor] : %orig; -} -%end - -%hook YTSearchViewController -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? [UIColor blackColor] : %orig; -} -%end - -%hook YTSectionListViewController -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? [UIColor blackColor] : %orig; -} -%end - -%hook YTWatchMiniBarViewController -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? [UIColor blackColor] : %orig; -} -%end - -%hook YTWrapperSplitViewController -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - return pageStyle == 1 ? [UIColor blackColor] : %orig; -} -%end - // Explore %hook ASScrollView - (void)didMoveToWindow { @@ -1349,12 +915,12 @@ UIColor* raisedColor = [UIColor blackColor]; } %end -// Sub? +// Sub menu? %hook ELMView - (void)didMoveToWindow { %orig; if (isDarkMode()) { - self.subviews[0].backgroundColor = [UIColor blackColor]; + self.subviews[0].backgroundColor = [UIColor clearColor]; } } %end @@ -1389,6 +955,7 @@ UIColor* raisedColor = [UIColor blackColor]; %hook YTSearchBoxView - (void)setBackgroundColor:(UIColor *)color { return isDarkMode() ? %orig([UIColor blackColor]) : %orig; + } %end @@ -1451,6 +1018,12 @@ UIColor* raisedColor = [UIColor blackColor]; } %end +%hook YTCollectionView +- (void)setBackgroundColor:(UIColor *)color { + return isDarkMode() ? %orig([UIColor blackColor]) : %orig; +} +%end + // %hook YTBackstageCreateRepostDetailView - (void)setBackgroundColor:(UIColor *)color { @@ -1465,6 +1038,7 @@ UIColor* raisedColor = [UIColor blackColor]; if (isDarkMode()) { if ([self.nextResponder isKindOfClass:%c(ASScrollView)]) { self.backgroundColor = [UIColor clearColor]; } if ([self.accessibilityIdentifier isEqualToString:@"eml.cvr"]) { self.backgroundColor = [UIColor blackColor]; } + if ([self.accessibilityIdentifier isEqualToString:@"eml.live_chat_text_message"]) { self.backgroundColor = [UIColor blackColor]; } if ([self.accessibilityIdentifier isEqualToString:@"rich_header"]) { self.backgroundColor = [UIColor blackColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.ui.comment_cell"]) { self.backgroundColor = [UIColor blackColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.ui.cancel.button"]) { self.superview.backgroundColor = [UIColor clearColor]; } @@ -1473,7 +1047,7 @@ UIColor* raisedColor = [UIColor blackColor]; if ([self.accessibilityIdentifier isEqualToString:@"id.comment.guidelines_text"]) { self.superview.backgroundColor = [UIColor blackColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_bottom_sheet_container"]) { self.backgroundColor = [UIColor blackColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_entry_banner_container"]) { self.backgroundColor = [UIColor blackColor]; } - if ([self.accessibilityIdentifier isEqualToString:@"id.comment.comment_group_detail_container"]) { self.backgroundColor = [UIColor clearColor]; } + if ([self.accessibilityIdentifier isEqualToString:@"id.comment.comment_group_detail_container"]) { self.backgroundColor = [UIColor clearColor]; } } } %end