Skip to content

Commit

Permalink
LowContrastMode v1.2.1
Browse files Browse the repository at this point in the history
Changed the way stuff worked for YTCommonColorPalette. this is using a new branch because the previous branch was too cluttered.
  • Loading branch information
arichornlover authored Jan 28, 2023
1 parent 955f784 commit 744a4ac
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 46 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TARGET := iphone:clang:latest:11.0
TARGET := iphone:clang:16.2:13.0

include $(THEOS)/makefiles/common.mk

Expand Down
109 changes: 65 additions & 44 deletions Tweak.xm
Original file line number Diff line number Diff line change
@@ -1,91 +1,112 @@
#import "Tweak.h"

// Low Contrast Mode v1.1.0
%hook UIColor // Changes the whiteColor Method to be YouTube's old ui and also effects Icons & Text under Videos, Comment Section & Shorts caused by whiteColor (Deprecated by YouTube as of v17.40.5-Newer)
+ (UIColor *)whiteColor { // Deprecated by YouTube
// Low Contrast Mode v1.2.1
%hook UIColor
+ (UIColor *)whiteColor { // Dark Theme Color
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
}
+ (UIColor *)whiteColor2 { // Light Theme Color
return [UIColor colorWithRed: 0.38 green: 0.38 blue: 0.38 alpha: 1.00];
}
+ (UIColor *)textColor {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
}
+ (UIColor *)dynamicLabelColor {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
}
%end

%hook YTColorPalette // Changes Texts & Icons in YouTube Bottom Bar + Text Icons under Video Player
- (UIColor *)textPrimary {
if (self.pageStyle == 1) {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00]; // Dark Mode
return [UIColor whiteColor]; // Dark Theme
}
return [UIColor colorWithRed: 0.38 green: 0.38 blue: 0.38 alpha: 1.00]; // Light Mode
return [UIColor colorWithRed: 0.38 green: 0.38 blue: 0.38 alpha: 1.00]; // Light Theme
}
- (UIColor *)textSecondary {
if (self.pageStyle == 1) {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
return [UIColor whiteColor]; // Dark Theme
}
return [UIColor colorWithRed: 0.38 green: 0.38 blue: 0.38 alpha: 1.00];
return [UIColor whiteColor2]; // Light Theme
}
%end

%hook YTCommonColorPalette // Changes Texts & Icons in YouTube Bottom Bar (Doesn't change Texts & Icons under the video player)
- (UIColor *)textPrimary {
if (self.pageStyle == 1) {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00]; // Dark Mode
return [UIColor whiteColor]; // Dark Theme
}
return [UIColor colorWithRed: 0.38 green: 0.38 blue: 0.38 alpha: 1.00]; // Light Mode
return [UIColor whiteColor2]; // Light Theme
}
- (UIColor *)textSecondary {
if (self.pageStyle == 1) {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
return [UIColor whiteColor]; // Dark Theme
}
return [UIColor whiteColor2]; // Light Theme
}
- (UIColor *)textPrimaryInverse {
if (self.pageStyle == 1) {
return [UIColor whiteColor]; // Dark Theme
}
return [UIColor whiteColor2]; // Light Theme
}
- (UIColor *)overlayTextPrimary {
if (self.pageStyle == 1) {
return [UIColor whiteColor]; // Dark Theme
}
return [UIColor whiteColor2]; // Light Theme
}
- (UIColor *)overlayTextSecondary {
if (self.pageStyle == 1) {
return [UIColor whiteColor]; // Dark Theme
}
return [UIColor whiteColor2]; // Light Theme
}
- (UIColor *)overlayTextTertiary {
if (self.pageStyle == 1) {
return [UIColor whiteColor]; // Dark Theme
}
return [UIColor whiteColor2]; // Light Theme
}
- (UIColor *)overlayButtonPrimary {
if (self.pageStyle == 1) {
return [UIColor whiteColor]; // Dark Theme
}
return [UIColor colorWithRed: 0.38 green: 0.38 blue: 0.38 alpha: 1.00];
return [UIColor whiteColor2]; // Light Theme
}
- (UIColor *)overlayButtonSecondary {
if (self.pageStyle == 1) {
return [UIColor whiteColor]; // Dark Theme
}
return [UIColor whiteColor2]; // Light Theme
}
%end

%hook YTQTMButton // Changes Tweak Icons/Texts/Images
- (UIColor *)sponsorBlockButton {
- (UIColor *)whiteColor {
return [UIColor whiteColor];
}
%end

%hook UIView // Changes some of the texts around the YouTube App.
- (UIColor *)tintColor {
- (UIColor *)whiteColor {
return [UIColor whiteColor];
}
%end

%hook UIInterface // Chanbes some of the texts that uses UIInterface in the YouTube App.
- (UIColor *)labelColor {
return [UIColor whiteColor];
}
- (UIColor *)secondaryLabelColor {
%hook ELMAnimatedVectorView // Changes the Like Button Animation Color.
- (UIColor *)_ASDisplayView {
return [UIColor whiteColor];
}
- (UIColor *)tertiaryLabelColor {
return [UIColor whiteColor];
}
- (UIColor *)quaternaryLabelColor {
}
- (UIColor *)ELMAnimatedVectorView {
return [UIColor whiteColor];
}
%end

%hook ELMView // Changes the Texts in the Sub Menu
- (void)didMoveToWindow {
%orig;
if (isDarkMode()) {
self.subviews[0].tintColor = [UIColor whiteColor];
}
}
%end

%hook _ASDisplayView
- (void)didMoveToWindow {
%orig;
if (isDarkMode()) {
if ([self.nextResponder isKindOfClass:%c(ASScrollView)]) { self.tintColor = [UIColor whiteColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"eml.cvr"]) { self.tintColor = [UIColor whiteColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"rich_header"]) { self.tintColor = [UIColor whiteColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.ui.comment_cell"]) { self.tintColor = [UIColor whiteColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.ui.cancel.button"]) { self.superview.tintColor = [UIColor whiteColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.comment_composer"]) { self.tintColor = [UIColor whiteColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.video_list_entry"]) { self.tintColor = [UIColor whiteColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.guidelines_text"]) { self.superview.tintColor = [UIColor whiteColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_bottom_sheet_container"]) { self.tintColor = [UIColor whiteColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_entry_banner_container"]) { self.tintColor = [UIColor whiteColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.comment_composer"]) { self.tintColor = [UIColor whiteColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.video_list_entry"]) { self.tintColor = [UIColor whiteColor]; }
}
%end
%end
2 changes: 1 addition & 1 deletion control
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: com.arichorn.lowcontrastmode
Name: LowContrastMode
Version: 1.1.0
Version: 1.2.1
Architecture: iphoneos-arm
Description: Tries to make YouTube easier on the eyes.
Maintainer: arichorn
Expand Down

0 comments on commit 744a4ac

Please sign in to comment.