Compare commits

...

30 Commits

Author SHA1 Message Date
GitHub Actions
8c89858dc0 updated submodules 2025-06-17 01:01:37 +00:00
GitHub Actions
8cc0ecc25b updated submodules 2025-06-16 01:03:48 +00:00
GitHub Actions
73fbef60b9 updated submodules 2025-06-15 01:08:17 +00:00
GitHub Actions
dcb74059a4 updated submodules 2025-06-14 00:59:19 +00:00
GitHub Actions
f247932b4c updated submodules 2025-06-13 01:01:59 +00:00
GitHub Actions
a0e27d1706 updated submodules 2025-06-12 01:01:05 +00:00
GitHub Actions
2faeaeb529 updated submodules 2025-06-11 01:01:44 +00:00
aricloverGitHub (INACTIVE)
596a409d61 LowContrastMode v1.7.1.1 2025-06-10 11:56:14 -05:00
GitHub Actions
ccc4ab55a3 updated submodules 2025-06-10 01:02:28 +00:00
GitHub Actions
1bc5e70b24 updated submodules 2025-06-09 01:04:51 +00:00
GitHub Actions
578a5dfd5f updated submodules 2025-06-08 01:06:57 +00:00
GitHub Actions
0ad65e8cc2 updated submodules 2025-06-07 01:00:08 +00:00
UnoCap
95500ab0f2 Update (#588) 2025-06-06 11:34:02 +02:00
GitHub Actions
40eec73776 updated submodules 2025-06-06 01:01:05 +00:00
GitHub Actions
a2bcc4dcc4 updated submodules 2025-06-05 01:00:46 +00:00
GitHub Actions
7a63fad293 updated submodules 2025-06-04 01:01:31 +00:00
GitHub Actions
9086575975 updated submodules 2025-06-03 01:02:03 +00:00
GitHub Actions
317b3434c8 updated submodules 2025-06-01 01:12:54 +00:00
GitHub Actions
31f9e30d7d updated submodules 2025-05-31 00:59:25 +00:00
GitHub Actions
d53f0181ac updated submodules 2025-05-30 00:59:58 +00:00
GitHub Actions
136149c586 updated submodules 2025-05-29 01:00:48 +00:00
GitHub Actions
30925e6464 updated submodules 2025-05-28 01:00:50 +00:00
GitHub Actions
2259fa5d67 updated submodules 2025-05-27 00:59:15 +00:00
GitHub Actions
87202b70fb updated submodules 2025-05-26 01:01:54 +00:00
GitHub Actions
9c761884af updated submodules 2025-05-25 01:05:53 +00:00
GitHub Actions
9841105ef7 updated submodules 2025-05-24 00:57:41 +00:00
GitHub Actions
f2c6c6669c updated submodules 2025-05-23 00:59:57 +00:00
GitHub Actions
e18a3d045d updated submodules 2025-05-22 01:00:15 +00:00
GitHub Actions
4b08bf4d7c updated submodules 2025-05-21 01:00:32 +00:00
GitHub Actions
b7480a7a98 updated submodules 2025-05-20 01:00:56 +00:00
13 changed files with 308 additions and 289 deletions

2
.gitmodules vendored
View File

@@ -48,7 +48,7 @@
url = https://github.com/PoomSmart/YouQuality url = https://github.com/PoomSmart/YouQuality
[submodule "Tweaks/Return-YouTube-Dislikes"] [submodule "Tweaks/Return-YouTube-Dislikes"]
path = Tweaks/Return-YouTube-Dislikes path = Tweaks/Return-YouTube-Dislikes
url = https://github.com/arichornloverALT/Return-YouTube-Dislikes.git url = https://github.com/PoomSmart/Return-YouTube-Dislikes.git
[submodule "Tweaks/YTHeaders"] [submodule "Tweaks/YTHeaders"]
path = Tweaks/YTHeaders path = Tweaks/YTHeaders
url = https://github.com/therealFoxster/YTHeaders url = https://github.com/therealFoxster/YTHeaders

View File

@@ -1,492 +1,511 @@
#import "../YTLitePlus.h" #import "../YTLitePlus.h"
// Low Contrast Mode - @arichornlover // Color Configuration
static int contrastMode() { static UIColor *lcmHexColor = nil;
static UIColor *const kLowContrastColor = [UIColor colorWithRed:0.56 green:0.56 blue:0.56 alpha:1.0];
static UIColor *const kDefaultTextColor = [UIColor whiteColor];
// Utility Functions
static inline int contrastMode() {
return [[NSUserDefaults standardUserDefaults] integerForKey:@"lcm"]; return [[NSUserDefaults standardUserDefaults] integerForKey:@"lcm"];
} }
static BOOL lowContrastMode() {
return IsEnabled(@"lowContrastMode_enabled") && contrastMode() == 0; static inline BOOL lowContrastMode() {
} return IS_ENABLED(@"lowContrastMode_enabled") && contrastMode() == 0;
static BOOL customContrastMode() {
return IsEnabled(@"lowContrastMode_enabled") && contrastMode() == 1;
} }
UIColor *lcmHexColor; static inline BOOL customContrastMode() {
return IS_ENABLED(@"lowContrastMode_enabled") && contrastMode() == 1;
}
%group gLowContrastMode // Low Contrast Mode v1.6.1 (Compatible with only YouTube v17.33.2-v18.34.5) // static inline UIColor *activeColor() {
// return customContrastMode() && lcmHexColor ? lcmHexColor : kLowContrastColor;
// }
// Low Contrast Mode v1.7.1.1 (Compatible with only YouTube v19.01.1-v20.21.6)
%group gLowContrastMode
%hook UIColor %hook UIColor
+ (UIColor *)whiteColor { // Dark Theme Color + (UIColor *)colorNamed:(NSString *)name {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00]; NSArray<NSString *> *targetColors = @[
} @"whiteColor", @"lightTextColor", @"lightGrayColor", @"ychGrey7",
+ (UIColor *)lightTextColor { @"skt_chipBackgroundColor", @"placeholderTextColor", @"systemLightGrayColor",
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00]; @"systemExtraLightGrayColor", @"labelColor", @"secondaryLabelColor",
} @"tertiaryLabelColor", @"quaternaryLabelColor"
+ (UIColor *)placeholderTextColor { ];
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00]; return [targetColors containsObject:name] ? kLowContrastColor : %orig;
}
+ (UIColor *)labelColor {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
}
+ (UIColor *)secondaryLabelColor {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
}
+ (UIColor *)tertiaryLabelColor {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
}
+ (UIColor *)quaternaryLabelColor {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
} }
+ (UIColor *)whiteColor { return kLowContrastColor; }
+ (UIColor *)lightTextColor { return kLowContrastColor; }
+ (UIColor *)lightGrayColor { return kLowContrastColor; }
%end %end
%hook YTCommonColorPalette %hook YTCommonColorPalette
- (UIColor *)textPrimary { - (UIColor *)textPrimary {
NSLog(@"LowContrastMode: textPrimary called"); return self.pageStyle == 1 ? kDefaultTextColor : %orig;
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig;
} }
- (UIColor *)textSecondary { - (UIColor *)textSecondary {
NSLog(@"LowContrastMode: textSecondary called"); return self.pageStyle == 1 ? kDefaultTextColor : %orig;
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig;
} }
- (UIColor *)overlayTextPrimary { - (UIColor *)overlayTextPrimary {
NSLog(@"LowContrastMode: overlayTextPrimary called"); return self.pageStyle == 1 ? kDefaultTextColor : %orig;
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig;
} }
- (UIColor *)overlayTextSecondary { - (UIColor *)overlayTextSecondary {
NSLog(@"LowContrastMode: overlayTextSecondary called"); return self.pageStyle == 1 ? kDefaultTextColor : %orig;
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig;
} }
- (UIColor *)iconActive { - (UIColor *)iconActive {
NSLog(@"LowContrastMode: iconActive called"); return self.pageStyle == 1 ? kDefaultTextColor : %orig;
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig;
} }
- (UIColor *)iconActiveOther { - (UIColor *)iconActiveOther {
NSLog(@"LowContrastMode: iconActiveOther called"); return self.pageStyle == 1 ? kDefaultTextColor : %orig;
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig;
} }
- (UIColor *)brandIconActive { - (UIColor *)brandIconActive {
NSLog(@"LowContrastMode: brandIconActive called"); return self.pageStyle == 1 ? kDefaultTextColor : %orig;
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig;
} }
- (UIColor *)staticBrandWhite { - (UIColor *)staticBrandWhite {
NSLog(@"LowContrastMode: staticBrandWhite called"); return self.pageStyle == 1 ? kDefaultTextColor : %orig;
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig;
} }
- (UIColor *)overlayIconActiveOther { - (UIColor *)overlayIconActiveOther {
NSLog(@"LowContrastMode: overlayIconActiveOther called"); return self.pageStyle == 1 ? kDefaultTextColor : %orig;
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig;
} }
- (UIColor *)overlayIconInactive { - (UIColor *)overlayIconInactive {
NSLog(@"LowContrastMode: overlayIconInactive called"); return self.pageStyle == 1 ? [kDefaultTextColor colorWithAlphaComponent:0.7] : %orig;
return self.pageStyle == 1 ? [[UIColor whiteColor] colorWithAlphaComponent:0.7] : %orig;
} }
- (UIColor *)overlayIconDisabled { - (UIColor *)overlayIconDisabled {
NSLog(@"LowContrastMode: overlayIconDisabled called"); return self.pageStyle == 1 ? [kDefaultTextColor colorWithAlphaComponent:0.3] : %orig;
return self.pageStyle == 1 ? [[UIColor whiteColor] colorWithAlphaComponent:0.3] : %orig;
} }
- (UIColor *)overlayFilledButtonActive { - (UIColor *)overlayFilledButtonActive {
NSLog(@"LowContrastMode: overlayFilledButtonActive called"); return self.pageStyle == 1 ? [kDefaultTextColor colorWithAlphaComponent:0.2] : %orig;
return self.pageStyle == 1 ? [[UIColor whiteColor] colorWithAlphaComponent:0.2] : %orig;
} }
%end %end
%hook YTColor %hook YTColor
+ (UIColor *)white2 { + (BOOL)darkerPaletteTextColorEnabled { return NO; }
return [UIColor whiteColor]; + (UIColor *)white1 { return kLowContrastColor; }
} + (UIColor *)white2 { return kLowContrastColor; }
+ (UIColor *)white3 { + (UIColor *)white3 { return kLowContrastColor; }
return [UIColor whiteColor]; + (UIColor *)white4 { return kLowContrastColor; }
} + (UIColor *)white5 { return kLowContrastColor; }
+ (UIColor *)white4 { + (UIColor *)grey1 { return kLowContrastColor; }
return [UIColor whiteColor]; + (UIColor *)grey2 { return kLowContrastColor; }
}
+ (UIColor *)white5 {
return [UIColor whiteColor];
}
%end %end
%hook _ASDisplayView %hook _ASDisplayView
- (void)layoutSubviews { - (void)layoutSubviews {
%orig; %orig;
NSArray<NSString *> *targetLabels = @[@"connect account", @"Thanks", @"Save to playlist", @"Report"];
for (UIView *subview in self.subviews) { for (UIView *subview in self.subviews) {
if ([subview.accessibilityLabel isEqualToString:@"connect account"]) { if ([targetLabels containsObject:subview.accessibilityLabel]) {
subview.backgroundColor = [UIColor whiteColor]; subview.backgroundColor = kLowContrastColor;
if ([subview isKindOfClass:[UILabel class]]) { if ([subview isKindOfClass:[UILabel class]]) {
UILabel *label = (UILabel *)subview; ((UILabel *)subview).textColor = [UIColor blackColor];
label.textColor = [UIColor blackColor];
}
} else if ([subview.accessibilityLabel isEqualToString:@"Thanks"]) {
subview.backgroundColor = [UIColor whiteColor];
if ([subview isKindOfClass:[UILabel class]]) {
UILabel *label = (UILabel *)subview;
label.textColor = [UIColor blackColor];
}
} else if ([subview.accessibilityLabel isEqualToString:@"Save to playlist"]) {
subview.backgroundColor = [UIColor whiteColor];
if ([subview isKindOfClass:[UILabel class]]) {
UILabel *label = (UILabel *)subview;
label.textColor = [UIColor blackColor];
}
} else if ([subview.accessibilityLabel isEqualToString:@"Report"]) {
subview.backgroundColor = [UIColor whiteColor];
if ([subview isKindOfClass:[UILabel class]]) {
UILabel *label = (UILabel *)subview;
label.textColor = [UIColor blackColor];
} }
} }
} }
} }
%end %end
%hook QTMColorGroup %hook QTMColorGroup
- (UIColor *)tint100 { - (UIColor *)tint100 { return kDefaultTextColor; }
return [UIColor whiteColor]; - (UIColor *)tint300 { return kDefaultTextColor; }
} - (UIColor *)tint500 { return kDefaultTextColor; }
- (UIColor *)tint300 { - (UIColor *)tint700 { return kDefaultTextColor; }
return [UIColor whiteColor]; - (UIColor *)accent200 { return kDefaultTextColor; }
} - (UIColor *)accent400 { return kDefaultTextColor; }
- (UIColor *)bodyTextColor { - (UIColor *)accentColor { return kDefaultTextColor; }
return [UIColor whiteColor]; - (UIColor *)brightAccentColor { return kDefaultTextColor; }
} - (UIColor *)regularColor { return kDefaultTextColor; }
- (UIColor *)bodyTextColorOnLighterColor { - (UIColor *)darkerColor { return kDefaultTextColor; }
return [UIColor whiteColor]; - (UIColor *)bodyTextColor { return kDefaultTextColor; }
} - (UIColor *)lightBodyTextColor { return kDefaultTextColor; }
- (UIColor *)bodyTextColorOnRegularColor { - (UIColor *)bodyTextColorOnRegularColor { return kDefaultTextColor; }
return [UIColor whiteColor]; - (UIColor *)bodyTextColorOnLighterColor { return kDefaultTextColor; }
} - (UIColor *)bodyTextColorOnDarkerColor { return kDefaultTextColor; }
- (UIColor *)bodyTextColorOnDarkerColor { - (UIColor *)bodyTextColorOnAccentColor { return kDefaultTextColor; }
return [UIColor whiteColor]; - (UIColor *)buttonBackgroundColor { return kDefaultTextColor; }
} - (UIColor *)Color { return kDefaultTextColor; }
- (UIColor *)bodyTextColorOnAccentColor {
return [UIColor whiteColor];
}
- (UIColor *)bodyTextColorOnOnBrightAccentColor {
return [UIColor whiteColor];
}
- (UIColor *)lightBodyTextColor {
return [UIColor whiteColor];
}
- (UIColor *)buttonBackgroundColor {
return [UIColor whiteColor];
}
%end %end
%hook YTQTMButton %hook YTQTMButton
- (void)setImage:(UIImage *)image { - (void)setImage:(UIImage *)image {
UIImage *currentImage = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; UIImage *tintedImage = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[self setTintColor:[UIColor whiteColor]]; [self setTintColor:kDefaultTextColor];
%orig(currentImage); %orig(tintedImage);
} }
%end %end
%hook UIExtendedSRGColorSpace
- (void)setTextColor:(UIColor *)textColor {
%orig([kDefaultTextColor colorWithAlphaComponent:0.9]);
}
%end
%hook UIExtendedSRGBColorSpace
- (void)setTextColor:(UIColor *)textColor {
%orig([kDefaultTextColor colorWithAlphaComponent:1.0]);
}
%end
%hook UIExtendedGrayColorSpace %hook UIExtendedGrayColorSpace
- (void)setTextColor:(UIColor *)textColor { - (void)setTextColor:(UIColor *)textColor {
textColor = [[UIColor whiteColor] colorWithAlphaComponent:1.0]; %orig([kDefaultTextColor colorWithAlphaComponent:1.0]);
%orig();
} }
%end %end
%hook VideoTitleLabel %hook VideoTitleLabel
- (void)setTextColor:(UIColor *)textColor { - (void)setTextColor:(UIColor *)textColor {
textColor = [UIColor whiteColor]; %orig(kDefaultTextColor);
%orig(textColor);
} }
%end %end
%hook UILabel %hook UILabel
+ (void)load { + (void)load {
@autoreleasepool { [[UILabel appearance] setTextColor:kDefaultTextColor];
[[UILabel appearance] setTextColor:[UIColor whiteColor]];
}
} }
- (void)setTextColor:(UIColor *)textColor { - (void)setTextColor:(UIColor *)textColor {
%log; %orig(kDefaultTextColor);
textColor = [UIColor whiteColor];
%orig(textColor);
} }
%end %end
%hook UITextField %hook UITextField
- (void)setTextColor:(UIColor *)textColor { - (void)setTextColor:(UIColor *)textColor {
%log; %orig(kDefaultTextColor);
textColor = [UIColor whiteColor];
%orig(textColor);
} }
%end %end
%hook UITextView %hook UITextView
- (void)setTextColor:(UIColor *)textColor { - (void)setTextColor:(UIColor *)textColor {
%log; %orig(kDefaultTextColor);
textColor = [UIColor whiteColor];
%orig(textColor);
} }
%end %end
%hook UISearchBar %hook UISearchBar
- (void)setTextColor:(UIColor *)textColor { - (void)setTextColor:(UIColor *)textColor {
textColor = [UIColor whiteColor]; %orig(kDefaultTextColor);
%orig(textColor);
} }
%end %end
%hook UISegmentedControl %hook UISegmentedControl
- (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state { - (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state {
NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attributes]; NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attributes];
[modifiedAttributes setObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName]; modifiedAttributes[NSForegroundColorAttributeName] = kDefaultTextColor;
%orig(modifiedAttributes, state); %orig(modifiedAttributes, state);
} }
%end %end
%hook UIButton %hook UIButton
- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state { - (void)setTitleColor:(UIColor *)color forState:(UIControlState)state {
color = [UIColor whiteColor]; %orig(kDefaultTextColor, state);
%orig(color, state);
} }
%end %end
%hook UIBarButtonItem %hook UIBarButtonItem
- (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state { - (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state {
NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attributes]; NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attributes];
[modifiedAttributes setObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName]; modifiedAttributes[NSForegroundColorAttributeName] = kDefaultTextColor;
%orig(modifiedAttributes, state); %orig(modifiedAttributes, state);
} }
%end %end
%hook NSAttributedString %hook NSAttributedString
- (instancetype)initWithString:(NSString *)str attributes:(NSDictionary<NSAttributedStringKey, id> *)attrs { - (instancetype)initWithString:(NSString *)str attributes:(NSDictionary<NSAttributedStringKey, id> *)attrs {
NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attrs]; NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attrs];
[modifiedAttributes setObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName]; modifiedAttributes[NSForegroundColorAttributeName] = kDefaultTextColor;
return %orig(str, modifiedAttributes); return %orig(str, modifiedAttributes);
} }
%end %end
%hook CATextLayer %hook CATextLayer
- (void)setTextColor:(CGColorRef)textColor { - (void)setTextColor:(CGColorRef)textColor {
%orig([UIColor whiteColor].CGColor); %orig(kDefaultTextColor.CGColor);
} }
%end %end
%hook ASTextNode %hook ASTextNode
- (NSAttributedString *)attributedString { - (NSAttributedString *)attributedString {
NSAttributedString *originalAttributedString = %orig; NSAttributedString *original = %orig;
NSMutableAttributedString *newAttributedString = [originalAttributedString mutableCopy]; NSMutableAttributedString *modified = [original mutableCopy];
[newAttributedString addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0, newAttributedString.length)]; [modified addAttribute:NSForegroundColorAttributeName value:kDefaultTextColor range:NSMakeRange(0, modified.length)];
return newAttributedString; return modified;
} }
%end %end
%hook ASTextFieldNode %hook ASTextFieldNode
- (void)setTextColor:(UIColor *)textColor { - (void)setTextColor:(UIColor *)textColor {
%orig([UIColor whiteColor]); %orig(kDefaultTextColor);
} }
%end %end
%hook ASTextView %hook ASTextView
- (void)setTextColor:(UIColor *)textColor { - (void)setTextColor:(UIColor *)textColor {
%orig([UIColor whiteColor]); %orig(kDefaultTextColor);
} }
%end %end
%hook ASButtonNode %hook ASButtonNode
- (void)setTextColor:(UIColor *)textColor { - (void)setTextColor:(UIColor *)textColor {
%orig([UIColor whiteColor]); %orig(kDefaultTextColor);
}
%end
%hook UIControl
- (UIColor *)backgroundColor {
return [UIColor blackColor];
} }
%end %end
%end %end
%group gCustomContrastMode // Custom Contrast Mode (Hex Color) // Custom Contrast Mode
%group gCustomContrastMode
%hook UIColor %hook UIColor
+ (UIColor *)whiteColor { + (UIColor *)colorNamed:(NSString *)name {
return lcmHexColor; NSArray<NSString *> *targetColors = @[
} @"whiteColor", @"lightTextColor", @"lightGrayColor", @"ychGrey7",
+ (UIColor *)lightTextColor { @"skt_chipBackgroundColor", @"placeholderTextColor", @"systemLightGrayColor",
return lcmHexColor; @"systemExtraLightGrayColor", @"labelColor", @"secondaryLabelColor",
} @"tertiaryLabelColor", @"quaternaryLabelColor"
+ (UIColor *)placeholderTextColor { ];
return lcmHexColor; return [targetColors containsObject:name] ? lcmHexColor : %orig;
}
+ (UIColor *)labelColor {
return lcmHexColor;
}
+ (UIColor *)secondaryLabelColor {
return lcmHexColor;
}
+ (UIColor *)tertiaryLabelColor {
return lcmHexColor;
}
+ (UIColor *)quaternaryLabelColor {
return lcmHexColor;
} }
+ (UIColor *)whiteColor { return lcmHexColor; }
+ (UIColor *)lightTextColor { return lcmHexColor; }
+ (UIColor *)lightGrayColor { return lcmHexColor; }
%end %end
%hook YTCommonColorPalette %hook YTCommonColorPalette
- (UIColor *)textPrimary { - (UIColor *)textPrimary {
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig; return self.pageStyle == 1 ? kDefaultTextColor : %orig;
} }
- (UIColor *)textSecondary { - (UIColor *)textSecondary {
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig; return self.pageStyle == 1 ? kDefaultTextColor : %orig;
} }
- (UIColor *)overlayTextPrimary { - (UIColor *)overlayTextPrimary {
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig; return self.pageStyle == 1 ? kDefaultTextColor : %orig;
} }
- (UIColor *)overlayTextSecondary { - (UIColor *)overlayTextSecondary {
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig; return self.pageStyle == 1 ? kDefaultTextColor : %orig;
} }
- (UIColor *)iconActive { - (UIColor *)iconActive {
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig; return self.pageStyle == 1 ? kDefaultTextColor : %orig;
} }
- (UIColor *)iconActiveOther { - (UIColor *)iconActiveOther {
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig; return self.pageStyle == 1 ? kDefaultTextColor : %orig;
} }
- (UIColor *)brandIconActive { - (UIColor *)brandIconActive {
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig; return self.pageStyle == 1 ? kDefaultTextColor : %orig;
} }
- (UIColor *)staticBrandWhite { - (UIColor *)staticBrandWhite {
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig; return self.pageStyle == 1 ? kDefaultTextColor : %orig;
} }
- (UIColor *)overlayIconActiveOther { - (UIColor *)overlayIconActiveOther {
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig; return self.pageStyle == 1 ? kDefaultTextColor : %orig;
}
- (UIColor *)overlayIconInactive {
return self.pageStyle == 1 ? [kDefaultTextColor colorWithAlphaComponent:0.7] : %orig;
}
- (UIColor *)overlayIconDisabled {
return self.pageStyle == 1 ? [kDefaultTextColor colorWithAlphaComponent:0.3] : %orig;
}
- (UIColor *)overlayFilledButtonActive {
return self.pageStyle == 1 ? [kDefaultTextColor colorWithAlphaComponent:0.2] : %orig;
} }
%end %end
%hook YTColor %hook YTColor
+ (UIColor *)white2 { + (BOOL)darkerPaletteTextColorEnabled { return NO; }
return [UIColor whiteColor]; + (UIColor *)white1 { return lcmHexColor; }
} + (UIColor *)white2 { return lcmHexColor; }
+ (UIColor *)white3 { + (UIColor *)white3 { return lcmHexColor; }
return [UIColor whiteColor]; + (UIColor *)white4 { return lcmHexColor; }
} + (UIColor *)white5 { return lcmHexColor; }
+ (UIColor *)white4 { + (UIColor *)grey1 { return lcmHexColor; }
return [UIColor whiteColor]; + (UIColor *)grey2 { return lcmHexColor; }
}
+ (UIColor *)white5 {
return [UIColor whiteColor];
}
%end %end
%hook QTMColorGroup
- (UIColor *)tint100 { %hook _ASDisplayView
return [UIColor whiteColor]; - (void)layoutSubviews {
} %orig;
- (UIColor *)tint300 { NSArray<NSString *> *targetLabels = @[@"connect account", @"Thanks", @"Save to playlist", @"Report"];
return [UIColor whiteColor]; for (UIView *subview in self.subviews) {
} if ([targetLabels containsObject:subview.accessibilityLabel]) {
- (UIColor *)bodyTextColor { subview.backgroundColor = lcmHexColor;
return [UIColor whiteColor]; if ([subview isKindOfClass:[UILabel class]]) {
} ((UILabel *)subview).textColor = [UIColor blackColor];
- (UIColor *)bodyTextColorOnLighterColor { }
return [UIColor whiteColor]; }
}
- (UIColor *)bodyTextColorOnRegularColor {
return [UIColor whiteColor];
}
- (UIColor *)bodyTextColorOnDarkerColor {
return [UIColor whiteColor];
}
- (UIColor *)bodyTextColorOnAccentColor {
return [UIColor whiteColor];
}
- (UIColor *)bodyTextColorOnOnBrightAccentColor {
return [UIColor whiteColor];
}
- (UIColor *)lightBodyTextColor {
return [UIColor whiteColor];
}
- (UIColor *)buttonBackgroundColor {
return [UIColor whiteColor];
}
%end
%hook YTQTMButton
- (void)setImage:(UIImage *)image {
UIImage *currentImage = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[self setTintColor:[UIColor whiteColor]];
%orig(currentImage);
}
%end
%hook UIExtendedGrayColorSpace
- (void)setTextColor:(UIColor *)textColor {
textColor = [[UIColor whiteColor] colorWithAlphaComponent:1.0];
%orig();
}
%end
%hook VideoTitleLabel
- (void)setTextColor:(UIColor *)textColor {
textColor = [UIColor whiteColor];
%orig(textColor);
}
%end
%hook UILabel
+ (void)load {
@autoreleasepool {
[[UILabel appearance] setTextColor:[UIColor whiteColor]];
} }
} }
- (void)setTextColor:(UIColor *)textColor { %end
%log;
textColor = [UIColor whiteColor]; %hook QTMColorGroup
%orig(textColor); - (UIColor *)tint100 { return kDefaultTextColor; }
- (UIColor *)tint300 { return kDefaultTextColor; }
- (UIColor *)tint500 { return kDefaultTextColor; }
- (UIColor *)tint700 { return kDefaultTextColor; }
- (UIColor *)accent200 { return kDefaultTextColor; }
- (UIColor *)accent400 { return kDefaultTextColor; }
- (UIColor *)accentColor { return kDefaultTextColor; }
- (UIColor *)brightAccentColor { return kDefaultTextColor; }
- (UIColor *)regularColor { return kDefaultTextColor; }
- (UIColor *)darkerColor { return kDefaultTextColor; }
- (UIColor *)bodyTextColor { return kDefaultTextColor; }
- (UIColor *)lightBodyTextColor { return kDefaultTextColor; }
- (UIColor *)bodyTextColorOnRegularColor { return kDefaultTextColor; }
- (UIColor *)bodyTextColorOnLighterColor { return kDefaultTextColor; }
- (UIColor *)bodyTextColorOnDarkerColor { return kDefaultTextColor; }
- (UIColor *)bodyTextColorOnAccentColor { return kDefaultTextColor; }
- (UIColor *)buttonBackgroundColor { return kDefaultTextColor; }
- (UIColor *)Color { return kDefaultTextColor; }
%end
%hook YTQTMButton
- (void)setImage:(UIImage *)image {
UIImage *tintedImage = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[self setTintColor:kDefaultTextColor];
%orig(tintedImage);
} }
%end %end
%hook UIExtendedSRGColorSpace
- (void)setTextColor:(UIColor *)textColor {
%orig([kDefaultTextColor colorWithAlphaComponent:0.9]);
}
%end
%hook UIExtendedSRGBColorSpace
- (void)setTextColor:(UIColor *)textColor {
%orig([kDefaultTextColor colorWithAlphaComponent:1.0]);
}
%end
%hook UIExtendedGrayColorSpace
- (void)setTextColor:(UIColor *)textColor {
%orig([kDefaultTextColor colorWithAlphaComponent:1.0]);
}
%end
%hook VideoTitleLabel
- (void)setTextColor:(UIColor *)textColor {
%orig(kDefaultTextColor);
}
%end
%hook UILabel
+ (void)load {
[[UILabel appearance] setTextColor:kDefaultTextColor];
}
- (void)setTextColor:(UIColor *)textColor {
%orig(kDefaultTextColor);
}
%end
%hook UITextField %hook UITextField
- (void)setTextColor:(UIColor *)textColor { - (void)setTextColor:(UIColor *)textColor {
%log; %orig(kDefaultTextColor);
textColor = [UIColor whiteColor];
%orig(textColor);
} }
%end %end
%hook UITextView %hook UITextView
- (void)setTextColor:(UIColor *)textColor { - (void)setTextColor:(UIColor *)textColor {
%log; %orig(kDefaultTextColor);
textColor = [UIColor whiteColor];
%orig(textColor);
} }
%end %end
%hook UISearchBar %hook UISearchBar
- (void)setTextColor:(UIColor *)textColor { - (void)setTextColor:(UIColor *)textColor {
textColor = [UIColor whiteColor]; %orig(kDefaultTextColor);
%orig(textColor);
} }
%end %end
%hook UISegmentedControl %hook UISegmentedControl
- (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state { - (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state {
NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attributes]; NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attributes];
[modifiedAttributes setObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName]; modifiedAttributes[NSForegroundColorAttributeName] = kDefaultTextColor;
%orig(modifiedAttributes, state); %orig(modifiedAttributes, state);
} }
%end %end
%hook UIButton %hook UIButton
- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state { - (void)setTitleColor:(UIColor *)color forState:(UIControlState)state {
color = [UIColor whiteColor]; %orig(kDefaultTextColor, state);
%orig(color, state);
} }
%end %end
%hook UIBarButtonItem %hook UIBarButtonItem
- (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state { - (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state {
NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attributes]; NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attributes];
[modifiedAttributes setObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName]; modifiedAttributes[NSForegroundColorAttributeName] = kDefaultTextColor;
%orig(modifiedAttributes, state); %orig(modifiedAttributes, state);
} }
%end %end
%hook NSAttributedString %hook NSAttributedString
- (instancetype)initWithString:(NSString *)str attributes:(NSDictionary<NSAttributedStringKey, id> *)attrs { - (instancetype)initWithString:(NSString *)str attributes:(NSDictionary<NSAttributedStringKey, id> *)attrs {
NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attrs]; NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attrs];
[modifiedAttributes setObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName]; modifiedAttributes[NSForegroundColorAttributeName] = kDefaultTextColor;
return %orig(str, modifiedAttributes); return %orig(str, modifiedAttributes);
} }
%end %end
%hook CATextLayer %hook CATextLayer
- (void)setTextColor:(CGColorRef)textColor { - (void)setTextColor:(CGColorRef)color {
%orig([UIColor whiteColor].CGColor); %orig(kDefaultTextColor.CGColor);
} }
%end %end
%hook ASTextNode %hook ASTextNode
- (NSAttributedString *)attributedString { - (NSAttributedString *)attributedString {
NSAttributedString *originalAttributedString = %orig; NSAttributedString *original = %orig;
NSMutableAttributedString *newAttributedString = [originalAttributedString mutableCopy]; NSMutableAttributedString *modified = [original mutableCopy];
[newAttributedString addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0, newAttributedString.length)]; [modified addAttribute:NSForegroundColorAttributeName value:kDefaultTextColor range:NSMakeRange(0, modified.length)];
return newAttributedString; return modified;
} }
%end %end
%hook ASTextFieldNode %hook ASTextFieldNode
- (void)setTextColor:(UIColor *)textColor { - (void)setTextColor:(UIColor *)textColor {
%orig([UIColor whiteColor]); %orig(kDefaultTextColor);
} }
%end %end
%hook ASTextView %hook ASTextView
- (void)setTextColor:(UIColor *)textColor { - (void)setTextColor:(UIColor *)textColor {
%orig([UIColor whiteColor]); %orig(kDefaultTextColor);
} }
%end %end
%hook ASButtonNode %hook ASButtonNode
- (void)setTextColor:(UIColor *)textColor { - (void)setTextColor:(UIColor *)textColor {
%orig([UIColor whiteColor]); %orig(kDefaultTextColor);
}
%end
%hook UIControl
- (UIColor *)backgroundColor {
return [UIColor blackColor];
} }
%end %end
%end %end
# pragma mark - ctor // Constructor
%ctor { %ctor {
%init; %init;
if (lowContrastMode()) { if (lowContrastMode()) {
%init(gLowContrastMode); %init(gLowContrastMode);
} }
if (customContrastMode()) { if (customContrastMode()) {
%init(gCustomContrastMode); NSData *colorData = [[NSUserDefaults standardUserDefaults] objectForKey:@"kCustomUIColor"];
if (colorData) {
NSError *error = nil;
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:colorData error:&error];
if (!error) {
[unarchiver setRequiresSecureCoding:NO];
lcmHexColor = [unarchiver decodeObjectForKey:NSKeyedArchiveRootObjectKey];
if (lcmHexColor) {
%init(gCustomContrastMode);
}
}
}
} }
} }