Better Themes - uYouEnhanced

This commit is contained in:
arichornlover 2024-01-11 20:52:20 -06:00 committed by GitHub
parent 52bcf40fc2
commit 43e497fb5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -373,25 +373,25 @@ UIColor *customHexColor;
%group gCustomTheme %group gCustomTheme
%hook YTCommonColorPalette %hook YTCommonColorPalette
- (UIColor *)baseBackground { - (UIColor *)baseBackground {
return self.pageStyle == 1 ? [UIColor customHexColor] : %orig; return self.pageStyle == 1 ? customHexColor : %orig;
} }
- (UIColor *)brandBackgroundSolid { - (UIColor *)brandBackgroundSolid {
return self.pageStyle == 1 ? [UIColor customHexColor] : %orig; return self.pageStyle == 1 ? customHexColor : %orig;
} }
- (UIColor *)brandBackgroundPrimary { - (UIColor *)brandBackgroundPrimary {
return self.pageStyle == 1 ? [UIColor customHexColor] : %orig; return self.pageStyle == 1 ? customHexColor : %orig;
} }
- (UIColor *)brandBackgroundSecondary { - (UIColor *)brandBackgroundSecondary {
return self.pageStyle == 1 ? [[UIColor customHexColor] colorWithAlphaComponent:0.9] : %orig; return self.pageStyle == 1 ? [customHexColor colorWithAlphaComponent:0.9] : %orig;
} }
- (UIColor *)raisedBackground { - (UIColor *)raisedBackground {
return self.pageStyle == 1 ? [UIColor customHexColor] : %orig; return self.pageStyle == 1 ? customHexColor : %orig;
} }
- (UIColor *)staticBrandBlack { - (UIColor *)staticBrandBlack {
return self.pageStyle == 1 ? [UIColor customHexColor] : %orig; return self.pageStyle == 1 ? customHexColor : %orig;
} }
- (UIColor *)generalBackgroundA { - (UIColor *)generalBackgroundA {
return self.pageStyle == 1 ? [UIColor customHexColor] : %orig; return self.pageStyle == 1 ? customHexColor : %orig;
} }
%end %end
@ -401,38 +401,38 @@ UIColor *customHexColor;
%orig; %orig;
UIView *systemBackgroundView = [self valueForKey:@"_systemBackgroundView"]; UIView *systemBackgroundView = [self valueForKey:@"_systemBackgroundView"];
NSString *backgroundViewKey = class_getInstanceVariable(systemBackgroundView.class, "_colorView") ? @"_colorView" : @"_backgroundView"; NSString *backgroundViewKey = class_getInstanceVariable(systemBackgroundView.class, "_colorView") ? @"_colorView" : @"_backgroundView";
((UIView *)[systemBackgroundView valueForKey:backgroundViewKey]).backgroundColor = [UIColor customHexColor]; ((UIView *)[systemBackgroundView valueForKey:backgroundViewKey]).backgroundColor = customHexColor;
} }
- (void)_layoutSystemBackgroundView:(BOOL)arg1 { - (void)_layoutSystemBackgroundView:(BOOL)arg1 {
%orig; %orig;
((UIView *)[[self valueForKey:@"_systemBackgroundView"] valueForKey:@"_colorView"]).backgroundColor = [UIColor customHexColor]; ((UIView *)[[self valueForKey:@"_systemBackgroundView"] valueForKey:@"_colorView"]).backgroundColor = customHexColor;
} }
%end %end
%hook settingsReorderTable %hook settingsReorderTable
- (void)viewDidLayoutSubviews { - (void)viewDidLayoutSubviews {
%orig; %orig;
self.tableView.backgroundColor = [UIColor customHexColor]; self.tableView.backgroundColor = customHexColor;
} }
%end %end
%hook FRPSelectListTable %hook FRPSelectListTable
- (void)viewDidLayoutSubviews { - (void)viewDidLayoutSubviews {
%orig; %orig;
self.tableView.backgroundColor = [UIColor customHexColor]; self.tableView.backgroundColor = customHexColor;
} }
%end %end
%hook FRPreferences %hook FRPreferences
- (void)viewDidLayoutSubviews { - (void)viewDidLayoutSubviews {
%orig; %orig;
self.tableView.backgroundColor = [UIColor customHexColor]; self.tableView.backgroundColor = customHexColor;
} }
%end %end
%hook YTInnerTubeCollectionViewController %hook YTInnerTubeCollectionViewController
- (UIColor *)backgroundColor:(NSInteger)pageStyle { - (UIColor *)backgroundColor:(NSInteger)pageStyle {
return pageStyle == 1 ? [UIColor customHexColor] : %orig; return pageStyle == 1 ? customHexColor : %orig;
} }
%end %end
@ -451,7 +451,7 @@ UIColor *customHexColor;
- (void)didMoveToWindow { - (void)didMoveToWindow {
%orig; %orig;
if (IS_DARK_APPEARANCE_ENABLED && [self.nextResponder isKindOfClass:%c(_ASDisplayView)]) { if (IS_DARK_APPEARANCE_ENABLED && [self.nextResponder isKindOfClass:%c(_ASDisplayView)]) {
self.superview.backgroundColor = [UIColor customHexColor]; self.superview.backgroundColor = customHexColor;
} }
} }
%end %end
@ -471,7 +471,7 @@ UIColor *customHexColor;
- (void)viewDidLoad { - (void)viewDidLoad {
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) { if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
%orig; %orig;
self.tableView.backgroundColor = [UIColor customHexColor]; self.tableView.backgroundColor = customHexColor;
} else { return %orig; } } else { return %orig; }
} }
%end %end
@ -480,7 +480,7 @@ UIColor *customHexColor;
- (void)viewDidLoad { - (void)viewDidLoad {
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) { if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
%orig; %orig;
self.view.backgroundColor = [UIColor customHexColor]; self.view.backgroundColor = customHexColor;
} else { return %orig; } } else { return %orig; }
} }
%end %end
@ -488,14 +488,14 @@ UIColor *customHexColor;
// Search view // Search view
%hook YTSearchBarView %hook YTSearchBarView
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig([UIColor customHexColor]) : %orig; return IS_DARK_APPEARANCE_ENABLED ? %orig(customHexColor) : %orig;
} }
%end %end
// History search view // History search view
%hook YTSearchBoxView %hook YTSearchBoxView
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig([UIColor customHexColor]) : %orig; return IS_DARK_APPEARANCE_ENABLED ? %orig(customHexColor) : %orig;
} }
%end %end
@ -503,19 +503,19 @@ UIColor *customHexColor;
// Comment view // Comment view
%hook YTCommentView %hook YTCommentView
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig([UIColor customHexColor]) : %orig; return IS_DARK_APPEARANCE_ENABLED ? %orig(customHexColor) : %orig;
} }
%end %end
%hook YTCreateCommentAccessoryView %hook YTCreateCommentAccessoryView
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig([UIColor customHexColor]) : %orig; return IS_DARK_APPEARANCE_ENABLED ? %orig(customHexColor) : %orig;
} }
%end %end
%hook YTCreateCommentTextView %hook YTCreateCommentTextView
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig([UIColor customHexColor]) : %orig; return IS_DARK_APPEARANCE_ENABLED ? %orig(customHexColor) : %orig;
} }
- (void)setTextColor:(UIColor *)color { // fix black text in #Shorts video's comment - (void)setTextColor:(UIColor *)color { // fix black text in #Shorts video's comment
return IS_DARK_APPEARANCE_ENABLED ? %orig([UIColor whiteColor]) : %orig; return IS_DARK_APPEARANCE_ENABLED ? %orig([UIColor whiteColor]) : %orig;
@ -526,7 +526,7 @@ UIColor *customHexColor;
- (void)didMoveToWindow { - (void)didMoveToWindow {
%orig; %orig;
if (IS_DARK_APPEARANCE_ENABLED) { if (IS_DARK_APPEARANCE_ENABLED) {
// self.subviews[2].backgroundColor = [UIColor customHexColor]; // self.subviews[2].backgroundColor = customHexColor;
} }
} }
%end %end
@ -540,13 +540,13 @@ UIColor *customHexColor;
// Live chat comment // Live chat comment
%hook YCHLiveChatActionPanelView %hook YCHLiveChatActionPanelView
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig([UIColor customHexColor]) : %orig; return IS_DARK_APPEARANCE_ENABLED ? %orig(customHexColor) : %orig;
} }
%end %end
%hook YTEmojiTextView %hook YTEmojiTextView
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig([UIColor customHexColor]) : %orig; return IS_DARK_APPEARANCE_ENABLED ? %orig(customHexColor) : %orig;
} }
%end %end
@ -554,21 +554,21 @@ UIColor *customHexColor;
- (void)didMoveToWindow { - (void)didMoveToWindow {
%orig; %orig;
if (IS_DARK_APPEARANCE_ENABLED) { if (IS_DARK_APPEARANCE_ENABLED) {
// self.subviews[1].backgroundColor = [UIColor customHexColor]; // self.subviews[1].backgroundColor = customHexColor;
} }
} }
%end %end
%hook YTCollectionView %hook YTCollectionView
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig([UIColor customHexColor]) : %orig; return IS_DARK_APPEARANCE_ENABLED ? %orig(customHexColor) : %orig;
} }
%end %end
// //
%hook YTBackstageCreateRepostDetailView %hook YTBackstageCreateRepostDetailView
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig([UIColor customHexColor]) : %orig; return IS_DARK_APPEARANCE_ENABLED ? %orig(customHexColor) : %orig;
} }
%end %end
@ -580,16 +580,16 @@ UIColor *customHexColor;
UIResponder *responder = [self nextResponder]; UIResponder *responder = [self nextResponder];
while (responder != nil) { while (responder != nil) {
if ([responder isKindOfClass:NSClassFromString(@"YTActionSheetDialogViewController")]) { if ([responder isKindOfClass:NSClassFromString(@"YTActionSheetDialogViewController")]) {
self.backgroundColor = [UIColor customHexColor]; self.backgroundColor = customHexColor;
} }
if ([responder isKindOfClass:NSClassFromString(@"YTPanelLoadingStrategyViewController")]) { if ([responder isKindOfClass:NSClassFromString(@"YTPanelLoadingStrategyViewController")]) {
self.backgroundColor = [UIColor customHexColor]; self.backgroundColor = customHexColor;
} }
if ([responder isKindOfClass:NSClassFromString(@"YTTabHeaderElementsViewController")]) { if ([responder isKindOfClass:NSClassFromString(@"YTTabHeaderElementsViewController")]) {
self.backgroundColor = [UIColor customHexColor]; self.backgroundColor = customHexColor;
} }
if ([responder isKindOfClass:NSClassFromString(@"YTEditSheetControllerElementsContentViewController")]) { if ([responder isKindOfClass:NSClassFromString(@"YTEditSheetControllerElementsContentViewController")]) {
self.backgroundColor = [UIColor customHexColor]; self.backgroundColor = customHexColor;
} }
responder = [responder nextResponder]; responder = [responder nextResponder];
} }
@ -599,21 +599,21 @@ UIColor *customHexColor;
%orig; %orig;
if (IS_DARK_APPEARANCE_ENABLED) { if (IS_DARK_APPEARANCE_ENABLED) {
if ([self.nextResponder isKindOfClass:%c(ASScrollView)]) { self.backgroundColor = [UIColor clearColor]; } if ([self.nextResponder isKindOfClass:%c(ASScrollView)]) { self.backgroundColor = [UIColor clearColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"brand_promo.view"]) { self.backgroundColor = [UIColor customHexColor]; } if ([self.accessibilityIdentifier isEqualToString:@"brand_promo.view"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"eml.cvr"]) { self.backgroundColor = [UIColor customHexColor]; } if ([self.accessibilityIdentifier isEqualToString:@"eml.cvr"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"eml.topic_channel_details"]) { self.backgroundColor = [UIColor customHexColor]; } if ([self.accessibilityIdentifier isEqualToString:@"eml.topic_channel_details"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"eml.live_chat_text_message"]) { self.backgroundColor = [UIColor customHexColor]; } if ([self.accessibilityIdentifier isEqualToString:@"eml.live_chat_text_message"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"rich_header"]) { self.backgroundColor = [UIColor customHexColor]; } if ([self.accessibilityIdentifier isEqualToString:@"rich_header"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"id.ui.comment_cell"]) { self.backgroundColor = [UIColor customHexColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.ui.comment_cell"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"id.ui.comment_thread"]) { self.backgroundColor = [UIColor customHexColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.ui.comment_thread"]) { self.backgroundColor = customHexColor; }
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]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.comment_composer"]) { self.backgroundColor = [UIColor customHexColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.comment_composer"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.filter_chip_bar"]) { self.backgroundColor = [UIColor customHexColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.filter_chip_bar"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.video_list_entry"]) { self.backgroundColor = [UIColor customHexColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.video_list_entry"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.guidelines_text"]) { self.superview.backgroundColor = [UIColor customHexColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.comment.guidelines_text"]) { self.superview.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.timed_comments_welcome"]) { self.superview.backgroundColor = self.backgroundColor = [UIColor customHexColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.comment.timed_comments_welcome"]) { self.superview.backgroundColor = self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_bottom_sheet_container"]) { self.backgroundColor = [UIColor customHexColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_bottom_sheet_container"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_entry_banner_container"]) { self.superview.backgroundColor = self.backgroundColor = [UIColor customHexColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_entry_banner_container"]) { self.superview.backgroundColor = self.backgroundColor = customHexColor; }
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]; }
} }
} }