Update OLED Dark mode feature

well, instead of hooking every view for YouTube to change the color, you can achieve the same results with less code by hooking the Color palette (YTColorPalette).
This commit is contained in:
BandarHelal
2022-05-09 23:39:02 +03:00
parent 5b70271968
commit 0c8376fc60
+56 -306
View File
@@ -11,6 +11,7 @@
#import "Tweaks/YouTubeHeader/YTIPivotBarSupportedRenderers.h" #import "Tweaks/YouTubeHeader/YTIPivotBarSupportedRenderers.h"
#import "Tweaks/YouTubeHeader/YTIPivotBarRenderer.h" #import "Tweaks/YouTubeHeader/YTIPivotBarRenderer.h"
#import "Tweaks/YouTubeHeader/YTIBrowseRequest.h" #import "Tweaks/YouTubeHeader/YTIBrowseRequest.h"
#import "Tweaks/YouTubeHeader/YTColorPalette.h"
BOOL hideHUD() { BOOL hideHUD() {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"hideHUD_enabled"]; return [[NSUserDefaults standardUserDefaults] boolForKey:@"hideHUD_enabled"];
@@ -180,329 +181,78 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
// Thanks u/DGh0st for his very well explained comment - https://www.reddit.com/r/jailbreakdevelopers/comments/9uape7/comment/e94sq80/ // Thanks u/DGh0st for his very well explained comment - https://www.reddit.com/r/jailbreakdevelopers/comments/9uape7/comment/e94sq80/
// Thanks sinfool for his flex patch which brings OLED Dark mode for YouTube - "Color Customizer (YouTube) OLED" // Thanks sinfool for his flex patch which brings OLED Dark mode for YouTube - "Color Customizer (YouTube) OLED"
%group gOLED %group gOLED
%hook UIView %hook YTColorPalette
- (void)setBackgroundColor:(id)arg1 { - (UIColor *)brandBackgroundSolid {
if ([self.nextResponder isKindOfClass:%c(YTLinkCell)]) if (self.pageStyle == 1) {
arg1 = oledColor; return oledColor;
if ([self.nextResponder isKindOfClass:%c(YTCommentsHeaderView)]) }
arg1 = oledColor; return %orig;
if ([self.nextResponder isKindOfClass:%c(YTSearchView)]) }
arg1 = oledColor; - (UIColor *)brandBackgroundPrimary {
if ([self.nextResponder isKindOfClass:%c(YTSearchBoxView)]) if (self.pageStyle == 1) {
arg1 = oledColor; return oledColor;
if ([self.nextResponder isKindOfClass:%c(YTEngagementPanelHeaderView)]) }
arg1 = oledColor; return %orig;
if ([self.nextResponder isKindOfClass:%c(YTEngagementPanelView)]) }
arg1 = oledColor; - (UIColor *)brandBackgroundSecondary {
if ([self.nextResponder isKindOfClass:%c(YTPivotBarView)]) if (self.pageStyle == 1) {
arg1 = oledColor; return oledColor;
if ([self.nextResponder isKindOfClass:%c(YTHUDMessageView)]) }
arg1 = oledColor; return %orig;
if ([self.nextResponder isKindOfClass:%c(YTChipCloudCell)]) }
arg1 = oledColor; - (UIColor *)staticBrandBlack {
if ([self.nextResponder isKindOfClass:%c(YCHLiveChatTextCell)]) if (self.pageStyle == 1) {
arg1 = oledColor; return oledColor;
if ([self.nextResponder isKindOfClass:%c(YCHLiveChatView)]) }
arg1 = oledColor; return %orig;
if ([self.nextResponder isKindOfClass:%c(YCHLiveChatViewerEngagementCell)]) }
arg1 = oledColor; - (UIColor *)generalBackgroundA {
if ([self.nextResponder isKindOfClass:%c(YTSlideForActionsView)]) if (self.pageStyle == 1) {
arg1 = oledColor; return oledColor;
if ([self.nextResponder isKindOfClass:%c(YTPlaylistHeaderView)]) }
arg1 = oledColor; return %orig;
if ([self.nextResponder isKindOfClass:%c(YTAsyncCollectionView)]) }
arg1 = oledColor; %end
if ([self.nextResponder isKindOfClass:%c(YTFeedHeaderView)])
arg1 = oledColor; // Account view controller
if ([self.nextResponder isKindOfClass:%c(YTMessageCell)]) %hook YTAccountPanelBodyViewController
arg1 = oledColor; - (UIColor *)backgroundColor:(NSInteger)pageStyle {
if ([self.nextResponder isKindOfClass:%c(YTPlaylistPanelProminentThumbnailVideoCell)]) if (pageStyle == 1) {
arg1 = oledColor; return oledColor;
if ([self.nextResponder isKindOfClass:%c(ASWAppSwitcherCollectionViewCell)]) }
arg1 = oledColor; return %orig;
if ([self.nextResponder isKindOfClass:%c(YTEditSheetControllerHeader)]) }
arg1 = oledColor; %end
if ([self.nextResponder isKindOfClass:%c(YTDialogContainerScrollView)])
arg1 = oledColor; // Explore
%hook ASScrollView
- (void)didMoveToWindow {
self.backgroundColor = oledColor;
%orig; %orig;
} }
%end %end
%hook YTLightweightQTMButton // uYou player and downloading view controller
- (void)setBackgroundColor:(id)arg1 { %hook _LNPopupBarContentView
if ([self.nextResponder isKindOfClass:%c(YTShareMainView)]) - (void)setBackgroundColor:(UIColor *)color {
arg1 = oledColor; return %orig(oledColor);
%orig;
}
- (void)setCustomTitleColor:(id)arg1 { %orig([UIColor whiteColor]); }
%end
%hook NIAttributedLabel
- (void)setBackgroundColor:(id)arg1 {
if ([self.nextResponder isKindOfClass:%c(UIScrollView)])
arg1 = oledColor;
%orig;
} }
%end %end
%hook UIControl // this sucks I know :/
- (void)setBackgroundColor:(id)arg1 {
if ([self.nextResponder isKindOfClass:%c(YTShareMainView)])
arg1 = oledColor;
%orig;
}
%end
%hook YTAsyncCollectionView
- (void)setBackgroundColor:(id)arg1 {
if([self.nextResponder isKindOfClass:%c(YTRelatedVideosCollectionViewController)]) {
arg1 = [oledColor colorWithAlphaComponent:0.0];
} else if([self.nextResponder isKindOfClass:%c(YTFullscreenMetadataHighlightsCollectionViewController)]) {
arg1 = [oledColor colorWithAlphaComponent:0.0];
} else {
arg1 = oledColor;
}
%orig;
}
%end
%hook YTWatchMiniBarView
- (void)setBackgroundColor:(id)arg1 {
arg1 = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.9];
%orig;
}
%end
%hook YTPlaylistMiniBarView
- (void)setBackgroundColor:(id)arg1 {
arg1 = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.9];
%orig;
}
%end
%hook _LNPopupBarContentView // uYou player
- (void)setBackgroundColor:(id)arg1 {
arg1 = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.9];
%orig;
}
%end
%hook YTTopAlignedView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
- (void)didMoveToWindow { // Dune - https://github.com/Skittyblock/Dune/blob/9b1df9790230115b7553cc9dbadf36889018d7f9/Tweak.xm#L70
MSHookIvar<UIView *>(self, "_contentView").backgroundColor = oledColor;
%orig;
}
%end
%hook DownloadedVC %hook DownloadedVC
- (id)ytBackgroundColor { return oledColor; } - (UIColor *)ytBackgroundColor { return oledColor; }
%end %end
%hook DownloadsPagerVC %hook DownloadsPagerVC
- (id)ytBackgroundColor { return oledColor; } - (UIColor *)ytBackgroundColor { return oledColor; }
%end %end
%hook DownloadingVC %hook DownloadingVC
- (id)ytBackgroundColor { return oledColor; } - (UIColor *)ytBackgroundColor { return oledColor; }
%end %end
%hook PlayerVC %hook PlayerVC
- (id)ytBackgroundColor { return oledColor; } - (UIColor *)ytBackgroundColor { return oledColor; }
%end %end
%hook ASScrollView // Explore
- (void)didMoveToWindow {
self.backgroundColor = oledColor;
%orig;
}
%end
%hook ASCollectionView // your videos
- (void)didMoveToWindow {
self.backgroundColor = oledColor;
%orig;
}
%end
%hook YTDialogContainerScrollView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook MDXQueueView // Cast queue
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTChannelProfileEditorView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTChannelSubMenuView //
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTChannelListSubMenuView // sub -
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTCommentView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTCreateCommentAccessoryView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTCreateCommentTextView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
- (void)setTextColor:(id)arg1 { %orig([UIColor whiteColor]); }
%end
%hook YCHLiveChatActionPanelView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTEmojiTextView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTShareTitleView // Share sheet
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTNavigationBar
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
- (void)setBarTintColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTPrivacyTosFooterView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTEngagementPanelHeaderView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTChannelMobileHeaderView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTInlineSignInView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTHeaderView //Stt bar
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTTabTitlesView // Tab bar - mychannel
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTSettingsCell // Settings
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTHorizontalCardListView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTShortsGalleryHeaderView // upload videos heaer (gallery)
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook GOODialogView // 3 dots menu
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTCollectionView //sharesheet
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook ASWAppSwitchingSheetHeaderView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook ASWAppSwitchingSheetFooterView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTCollectionSeparatorView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
- (void)didMoveToWindow {}
%end
%hook YTShareBusyView // sharesheet load
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTPageView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTWatchView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTSearchBarView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTSearchBoxView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTSearchSuggestionCollectionViewCell
- (void)updateColors {}
%end
%hook UISearchBarBackground
- (void)setBarTintColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTMealBarPromoView // Offline
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
////
/*
%hook UICollectionView
- (void)setBackgroundColor:(id)arg1 {
if ([self.nextResponder isKindOfClass:%c(UICollectionViewControllerWrapperView)])
arg1 = oledColor;
%orig;
}
%end
%hook _ASDisplayView // edit your videos
- (void)layoutSubviews {
if ([self.nextResponder isKindOfClass:%c(ELMView)])
self.backgroundColor = oledColor;
}
%end
%hook YTChannelProfileDescriptionEditorView // edit profile Description
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTChannelProfileNameEditorView // edit profile Name
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
hook GOOTextField
- (void)setBackgroundColor:(id)arg1 { // edit profile Description
arg1 = oledColor;
%orig;
}
%end
%hook GOOMultilineTextField//
- (void)setBackgroundColor:(id)arg1 { // edit profile Name
arg1 = oledColor;
%orig;
}
%end
*/
%end %end
%group gOLEDKB // OLED keyboard by @ichitaso <3 - http://gist.github.com/ichitaso/935100fd53a26f18a9060f7195a1be0e %group gOLEDKB // OLED keyboard by @ichitaso <3 - http://gist.github.com/ichitaso/935100fd53a26f18a9060f7195a1be0e