Skip to content

Commit

Permalink
Improved OLED Theme
Browse files Browse the repository at this point in the history
  • Loading branch information
dayanch96 committed Jun 16, 2024
1 parent b74cbca commit 4c4622f
Showing 1 changed file with 103 additions and 40 deletions.
143 changes: 103 additions & 40 deletions Source/Colours.xm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4c4622f

Please sign in to comment.