-
Notifications
You must be signed in to change notification settings - Fork 3
/
Tint.xm
158 lines (153 loc) · 4.08 KB
/
Tint.xm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
//#define kColor [UIColor colorWithRed:1.00 green:0.25 blue:0.00 alpha:1.0];
#import "Headers/ANEMWebImageButton.h"
#import <Headers/Interfaces.h>
%group Tint
%hook UIImageView
-(long long)_defaultRenderingMode{
if([self.superview isKindOfClass:NSClassFromString(@"ANEMWebImageButton")] || [self.superview.superview isKindOfClass:%c(PackageListHeader)]){
return 2;
}
return %orig;
}
-(void)setTintColor:(UIColor *)arg1{
if([self.superview isKindOfClass:NSClassFromString(@"ANEMWebImageButton")] || [self.superview.superview isKindOfClass:%c(PackageListHeader)] || [self.superview isKindOfClass:%c(DepictionTableButtonView)]){
arg1 = [prefs colorForKey:@"tintColor"];
%orig(arg1);
}
%orig(arg1);
}
%end
%hook UINavigationBar
-(void)setTintColor:(UIColor *)arg1{
arg1 = [prefs colorForKey:@"tintColor"];
%orig(arg1);
}
%end
%hook UINavigationButton
-(void)setTintColor:(UIColor *)arg1{
arg1 = [prefs colorForKey:@"tintColor"];
%orig(arg1);
}
%end
%hook UISegmentedControl
-(void)layoutSubviews {
%orig;
self.tintColor = [prefs colorForKey:@"tintColor"];
}
%end
%hook SourceProgressIndicatorView
-(void)setTintColor:(UIColor *)arg1 {
arg1 = [prefs colorForKey:@"tintColor"];
%orig(arg1);
}
%end
%hook UITabBar
-(void)setTintColor:(UIColor *)arg1{
arg1 = [prefs colorForKey:@"tintColor"];
%orig(arg1);
}
%end
%hook PackageQueueButton
-(void)setBackgroundColor:(id)arg1{
arg1 = [prefs colorForKey:@"tintColor"];
%orig(arg1);
}
%end
%hook FeaturedButton
-(void)setTitleColor:(id)arg1 forState:(unsigned long long)arg2 {
arg1 = [prefs colorForKey:@"tintColor"];
%orig(arg1, arg2);
}
%end
%hook DownloadConfirmButton
-(void)setBackgroundColor:(id)arg1{
arg1 = [prefs colorForKey:@"tintColor"];
%orig(arg1);
}
%end
%hook UIButton
-(void)setTitleColor:(id)arg1 forState:(unsigned long long)arg2 {
if (![self isKindOfClass:%c(PackageQueueButton)]) {
arg1 = [prefs colorForKey:@"tintColor"];
} else {
arg1 = [UIColor whiteColor];
}
%orig(arg1, arg2);
}
-(void)layoutSubviews {
%orig;
if ([self.superview isKindOfClass:%c(PackageListHeader)]) {
self.tintColor = [prefs colorForKey:@"tintColor"];
}
}
%end
%hook DepictionTableButtonView
-(void)layoutSubviews {
%orig;
if ([self valueForKey:@"_titleLabel"]){
UILabel *titleLabel = (UILabel *)[self valueForKey:@"_titleLabel"];
titleLabel.textColor = [prefs colorForKey:@"tintColor"];
}
}
%end
@interface DepictionTabControl : UIView
@property(nonatomic) _Bool highlighted;
@end
%hook UILabel
-(void)setTextColor:(id)arg1 {
if ([self.superview isMemberOfClass:%c(DepictionTabControl)]) {
DepictionTabControl* tabControl = (DepictionTabControl*)self.superview;
if (tabControl.highlighted) {
arg1 = [prefs colorForKey:@"tintColor"];
}
}
%orig;
}
%end
%hook UITabBarButton //This sets the color for any badge that belongs to a TabBarIcon.
-(void)layoutSubviews{
%orig;
UIView *badge = MSHookIvar<UIView*>(self, "_badge");
badge.backgroundColor = [prefs colorForKey:@"tintColor"];
}
%end
%hook UITableView
-(void)layoutSubviews {
%orig;
self.tintColor = [prefs colorForKey:@"tintColor"];
}
%end
%hook CSTextRenderView
-(void)layoutSubviews {
%orig;
self.tintColor = [prefs colorForKey:@"tintColor"];
}
%end
%hook UIView
-(void)setBackgroundColor:(id)arg1 {
if ([self.superview.superview isKindOfClass:%c(DepictionTabView)]) {
id tabView = self.superview.superview;
if ([tabView valueForKey:@"_tabViewHighlight"]) {
UIView *tabViewHighlight = (UIView *)[tabView valueForKey:@"_tabViewHighlight"];
if (tabViewHighlight == self) {
arg1 = [prefs colorForKey:@"tintColor"];
}
}
}
%orig;
}
%end
%hook UIButtonLabel
-(void)setTextColor:(id)arg1 {
if ([[(UILabel*)self _viewControllerForAncestor] isKindOfClass:%c(InstallViewController)] && [((UILabel*)self).superview isMemberOfClass:[UIButton class]]) {
arg1 = [prefs colorForKey:@"tintColor"];
}
%orig;
}
%end
%end
%ctor {
if ([prefs boolForKey:@"tintEnabled"]) {
%init(Tint);
}
}