Undo OLED & Old Dark Mode changes

This commit is contained in:
arichorn 2023-07-13 20:20:07 -05:00 committed by GitHub
parent 93cef9ed58
commit 22f017205d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -829,360 +829,44 @@ static void replaceTab(YTIGuideResponse *response) {
// Theme Options // Theme Options
// Old dark theme (gray) // Old dark theme (gray)
%group gOldDarkTheme %group gOldDarkTheme
UIColor *customColor = [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0]; %hook YTColdConfig
%hook YTCommonColorPalette - (BOOL)uiSystemsClientGlobalConfigUseDarkerPaletteBgColorForNative { return NO; }
- (UIColor *)brandBackgroundSolid { - (BOOL)uiSystemsClientGlobalConfigUseDarkerPaletteTextColorForNative { return NO; }
return self.pageStyle == 1 ? customColor : %orig; - (BOOL)enableCinematicContainerOnClient { return NO; }
}
- (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;
}
%end %end
%hook _ASDisplayView %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 { - (void)didMoveToWindow {
%orig; %orig;
if (isDarkMode()) { if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.comment_composer"]) { self.backgroundColor = [UIColor clearColor]; }
self.backgroundColor = [UIColor clearColor]; if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.video_list_entry"]) { self.backgroundColor = [UIColor clearColor]; }
}
} }
%end %end
// Your videos
%hook ASCollectionView %hook ASCollectionView
- (void)didMoveToWindow { - (void)didMoveToWindow {
%orig; %orig;
if (isDarkMode() && [self.nextResponder isKindOfClass:%c(_ASDisplayView)]) { self.superview.backgroundColor = [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0];
self.superview.backgroundColor = customColor;
}
} }
%end %end
// Sub? %hook YTFullscreenEngagementOverlayView
%hook ELMView
- (void)didMoveToWindow { - (void)didMoveToWindow {
%orig; %orig;
if (isDarkMode()) { self.subviews[0].backgroundColor = [UIColor clearColor];
self.subviews[0].backgroundColor = customColor;
}
} }
%end %end
// iSponsorBlock %hook YTRelatedVideosView
%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 { - (void)didMoveToWindow {
%orig; %orig;
if (isDarkMode()) { self.subviews[0].backgroundColor = [UIColor clearColor];
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(customColor) : %orig;
}
%end
%hook ASWAppSwitchingSheetFooterView
- (void)setBackgroundColor:(UIColor *)color {
return isDarkMode() ? %orig(customColor) : %orig;
}
%end
%hook ASWAppSwitcherCollectionViewCell
- (void)didMoveToWindow {
%orig;
if (isDarkMode()) {
self.backgroundColor = customColor;
self.subviews[1].backgroundColor = customColor;
self.superview.backgroundColor = customColor;
}
} }
%end %end
%end %end
// OLED dark mode by BandarHL // 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 %group gOLED
%hook YTCommonColorPalette %hook YTCommonColorPalette
- (UIColor *)brandBackgroundSolid { - (UIColor *)brandBackgroundSolid {
@ -1205,130 +889,12 @@ UIColor* raisedColor = [UIColor blackColor];
} }
%end %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 %hook YTInnerTubeCollectionViewController
- (UIColor *)backgroundColor:(NSInteger)pageStyle { - (UIColor *)backgroundColor:(NSInteger)pageStyle {
return pageStyle == 1 ? [UIColor blackColor] : %orig; return pageStyle == 1 ? [UIColor blackColor] : %orig;
} }
%end %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 // Explore
%hook ASScrollView %hook ASScrollView
- (void)didMoveToWindow { - (void)didMoveToWindow {
@ -1349,12 +915,12 @@ UIColor* raisedColor = [UIColor blackColor];
} }
%end %end
// Sub? // Sub menu?
%hook ELMView %hook ELMView
- (void)didMoveToWindow { - (void)didMoveToWindow {
%orig; %orig;
if (isDarkMode()) { if (isDarkMode()) {
self.subviews[0].backgroundColor = [UIColor blackColor]; self.subviews[0].backgroundColor = [UIColor clearColor];
} }
} }
%end %end
@ -1389,6 +955,7 @@ UIColor* raisedColor = [UIColor blackColor];
%hook YTSearchBoxView %hook YTSearchBoxView
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
return isDarkMode() ? %orig([UIColor blackColor]) : %orig; return isDarkMode() ? %orig([UIColor blackColor]) : %orig;
} }
%end %end
@ -1451,6 +1018,12 @@ UIColor* raisedColor = [UIColor blackColor];
} }
%end %end
%hook YTCollectionView
- (void)setBackgroundColor:(UIColor *)color {
return isDarkMode() ? %orig([UIColor blackColor]) : %orig;
}
%end
// //
%hook YTBackstageCreateRepostDetailView %hook YTBackstageCreateRepostDetailView
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
@ -1465,6 +1038,7 @@ UIColor* raisedColor = [UIColor blackColor];
if (isDarkMode()) { if (isDarkMode()) {
if ([self.nextResponder isKindOfClass:%c(ASScrollView)]) { self.backgroundColor = [UIColor clearColor]; } 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.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:@"rich_header"]) { self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.ui.comment_cell"]) { 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]; } 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.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_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.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 %end