diff --git a/Source/Colours.xm b/Source/Colours.xm index 609eb667..2b37a366 100644 --- a/Source/Colours.xm +++ b/Source/Colours.xm @@ -35,65 +35,128 @@ static BOOL isLowContrast = YTMU(@"YTMUltimateIsEnabled") && YTMU(@"lowContrast" @end #pragma mark - OLED Dark mode -%hook YTCommonColorPalette -- (UIColor *)brandBackgroundSolid { return isOLEDTheme ? [UIColor blackColor] : %orig; } -- (UIColor *)brandBackgroundPrimary { return isOLEDTheme ? [UIColor blackColor] : %orig; } -%end - -%hook YTPivotBarView -- (void)didMoveToWindow { - if (isOLEDTheme) self.subviews[0].backgroundColor = [UIColor blackColor]; - %orig; -} -%end - -%hook YTMMusicMenuTitleView -- (void)didMoveToWindow { - if (isOLEDTheme) self.backgroundColor = [UIColor blackColor]; - %orig; -} -%end +@interface YTColor : UIColor ++ (UIColor *)blackPure; +@end -%hook MDCSnackbarMessageView -- (void)didMoveToWindow { - if (isOLEDTheme) self.backgroundColor = [UIColor blackColor]; - %orig; +%hook YTColor ++ (UIColor *)black0 { + return isOLEDTheme ? [self blackPure] : %orig; } -%end -%hook YTMPlayerPageColorScheme -- (void)setMiniPlayerColor:(UIColor *)color { - isOLEDTheme ? %orig([UIColor blackColor]) : %orig; ++ (UIColor *)black1 { + return isOLEDTheme ? [self blackPure] : %orig; } -- (void)setQueueBackgroundColor:(UIColor *)color { - isOLEDTheme ? %orig([UIColor blackColor]) : %orig; ++ (UIColor *)black2 { + return isOLEDTheme ? [self blackPure] : %orig; } -- (void)setQueueCurrentlyPlayingBackgroundColor:(UIColor *)color { - isOLEDTheme ? %orig([UIColor blackColor]) : %orig; ++ (UIColor *)black3 { + return isOLEDTheme ? [self blackPure] : %orig; } -- (void)setTabViewColor:(UIColor *)color { - isOLEDTheme ? %orig([UIColor blackColor]) : %orig; ++ (UIColor *)black4 { + return isOLEDTheme ? [self blackPure] : %orig; } +%end -- (void)setAVSwitchBackgroundColor:(UIColor *)color { - %orig(color); - if (isOLEDTheme) [self setPlayButtonColor:color]; -} +%hook YTMPlayerPageColorScheme +- (UIColor *)backgroundColor { return isOLEDTheme ? [UIColor blackColor] : %orig; } +- (UIColor *)expandedTabsBackgroundColor { return isOLEDTheme ? [UIColor blackColor] : %orig; } +- (UIColor *)miniPlayerColor { return isOLEDTheme ? [UIColor blackColor] : %orig; } +- (UIColor *)expandedTabViewColor { return isOLEDTheme ? [UIColor blackColor] : %orig; } +- (UIColor *)overlayButtonColor { return isOLEDTheme ? [UIColor blackColor] : %orig; } +- (UIColor *)overlayErrorBackgroundColor { return isOLEDTheme ? [UIColor blackColor] : %orig; } +- (UIColor *)AVSwitchBackgroundColor { return isOLEDTheme ? [UIColor blackColor] : %orig; } +- (UIColor *)AVSwitchActiveModeColor { return isOLEDTheme ? [[UIColor whiteColor] colorWithAlphaComponent:0.1] : %orig; } +- (UIColor *)queueBackgroundColor { return isOLEDTheme ? [UIColor blackColor] : %orig; } +- (UIColor *)queueCurrentlyPlayingColor { return isOLEDTheme ? [[UIColor whiteColor] colorWithAlphaComponent:0.1] : %orig; } + +- (BOOL)gradientBackgroundEnabled { return isOLEDTheme ? NO : %orig; } +%end -- (void)setBackgroundColor:(UIColor *)color { - isOLEDTheme ? %orig([UIColor blackColor]) : %orig; +%hook YTPivotBarView +- (UIView *)contentView { + UIView *orig = %orig; + if (isOLEDTheme) orig.backgroundColor = [UIColor blackColor]; + return orig; } %end +@interface YTLightweightBrowseBackgroundView : UIView +@end + %hook YTLightweightBrowseBackgroundView -- (id)imageView { - return isOLEDTheme ? nil : %orig; +- (UIImageView *)imageView { + if (!isOLEDTheme) { + return %orig; + } + + self.backgroundColor = [UIColor blackColor]; + return nil; } %end +// %hook YTCommonColorPalette +// - (UIColor *)brandBackgroundSolid { return isOLEDTheme ? [UIColor blackColor] : %orig; } +// - (UIColor *)brandBackgroundPrimary { return isOLEDTheme ? [UIColor blackColor] : %orig; } +// %end + +// %hook YTPivotBarView +// - (void)didMoveToWindow { +// if (isOLEDTheme) self.subviews[0].backgroundColor = [UIColor blackColor]; +// %orig; +// } +// %end + +// %hook YTMMusicMenuTitleView +// - (void)didMoveToWindow { +// if (isOLEDTheme) self.backgroundColor = [UIColor blackColor]; +// %orig; +// } +// %end + +// %hook MDCSnackbarMessageView +// - (void)didMoveToWindow { +// if (isOLEDTheme) self.backgroundColor = [UIColor blackColor]; +// %orig; +// } +// %end + +// %hook YTMPlayerPageColorScheme +// - (void)setMiniPlayerColor:(UIColor *)color { +// isOLEDTheme ? %orig([UIColor blackColor]) : %orig; +// } + +// - (void)setQueueBackgroundColor:(UIColor *)color { +// isOLEDTheme ? %orig([UIColor blackColor]) : %orig; +// } + +// - (void)setQueueCurrentlyPlayingBackgroundColor:(UIColor *)color { +// isOLEDTheme ? %orig([UIColor blackColor]) : %orig; +// } + +// - (void)setTabViewColor:(UIColor *)color { +// isOLEDTheme ? %orig([UIColor blackColor]) : %orig; +// } + +// - (void)setAVSwitchBackgroundColor:(UIColor *)color { +// %orig(color); +// if (isOLEDTheme) [self setPlayButtonColor:color]; +// } + +// - (void)setBackgroundColor:(UIColor *)color { +// isOLEDTheme ? %orig([UIColor blackColor]) : %orig; +// } +// %end + +// %hook YTLightweightBrowseBackgroundView +// - (id)imageView { +// return isOLEDTheme ? nil : %orig; +// } +// %end + #pragma mark - OLED Dark Keyboard %hook UIPredictionViewController // support prediction bar - @ichitaso: http://gist.github.com/ichitaso/935100fd53a26f18a9060f7195a1be0e - (void)loadView {