Light mode color picker
This commit is contained in:
13
Tweak.xm
13
Tweak.xm
@ -4,7 +4,6 @@
|
|||||||
Dark Mode for Zenith's Grabber view!
|
Dark Mode for Zenith's Grabber view!
|
||||||
Copyright 2020 J.K. Hayslip (@iKilledAppl3) & ToxicAppl3 INSDC/iKilledAppl3 LLC.
|
Copyright 2020 J.K. Hayslip (@iKilledAppl3) & ToxicAppl3 INSDC/iKilledAppl3 LLC.
|
||||||
All code was written for learning purposes and credit must be given to the original author.
|
All code was written for learning purposes and credit must be given to the original author.
|
||||||
|
|
||||||
Written for Cooper Hull, @mac-user669.
|
Written for Cooper Hull, @mac-user669.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -16,6 +15,14 @@ Written for Cooper Hull, @mac-user669.
|
|||||||
-(void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
|
-(void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
|
||||||
%orig(previousTraitCollection);
|
%orig(previousTraitCollection);
|
||||||
if (kEnabled) {
|
if (kEnabled) {
|
||||||
|
NSString* colourString = NULL;
|
||||||
|
NSDictionary* preferencesDictionary = [NSDictionary dictionaryWithContentsOfFile: @"/var/mobile/Library/Preferences/com.mac-user669.zenithdark.plist"];
|
||||||
|
if(preferencesDictionary)
|
||||||
|
{
|
||||||
|
colourString = [preferencesDictionary objectForKey: @"kCustomLightColor"];
|
||||||
|
}
|
||||||
|
|
||||||
|
UIColor* lightColor = [SparkColourPickerUtils colourWithString: colourString withFallback: @"#FFFFFF:0.7"];
|
||||||
// if the tweak is enabled and the version is iOS 13 or later run our code
|
// if the tweak is enabled and the version is iOS 13 or later run our code
|
||||||
if (@available(iOS 13, *)) {
|
if (@available(iOS 13, *)) {
|
||||||
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
|
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
|
||||||
@ -23,7 +30,7 @@ Written for Cooper Hull, @mac-user669.
|
|||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
[self setBackgroundColor:kLightColor];
|
[self setBackgroundColor:lightColor];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,4 +107,4 @@ static void PreferencesChangedCallback(CFNotificationCenterRef center, void *obs
|
|||||||
|
|
||||||
dlopen ("/Library/MobileSubstrate/DynamicLibraries/Zenith.dylib", RTLD_NOW); // We use this to make sure we load Zenith's dynamic library at runtime so we can modify it with our tweak.
|
dlopen ("/Library/MobileSubstrate/DynamicLibraries/Zenith.dylib", RTLD_NOW); // We use this to make sure we load Zenith's dynamic library at runtime so we can modify it with our tweak.
|
||||||
|
|
||||||
}
|
}
|
@ -36,6 +36,7 @@ NSMutableDictionary *prefs;
|
|||||||
// Stock Zenith color we are using macros so we can call it later if need be.
|
// Stock Zenith color we are using macros so we can call it later if need be.
|
||||||
#define kLightColor [UIColor colorWithWhite:1.0 alpha:0.7]
|
#define kLightColor [UIColor colorWithWhite:1.0 alpha:0.7]
|
||||||
|
|
||||||
#define kColor1 [UIColor redColor]
|
#define kColor1 [UIColor redColor] // Color used for testing
|
||||||
|
|
||||||
// the PLIST path where all user settings are stored.
|
// the PLIST path where all user settings are stored.
|
||||||
#define PLIST_PATH @"/var/mobile/Library/Preferences/com.mac-user669.zenithdark.plist"
|
#define PLIST_PATH @"/var/mobile/Library/Preferences/com.mac-user669.zenithdark.plist"
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
<key>footerText</key>
|
<key>footerText</key>
|
||||||
<string>Default: #000000:0.44</string>
|
<string>Default: #000000:0.44</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
||||||
<dict>
|
<dict>
|
||||||
<key>cell</key>
|
<key>cell</key>
|
||||||
<string>PSLinkCell</string>
|
<string>PSLinkCell</string>
|
||||||
@ -66,12 +67,44 @@
|
|||||||
<true/>
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
<key>label</key>
|
<key>label</key>
|
||||||
<string>Color</string>
|
<string>Dark Color</string>
|
||||||
<key>key</key>
|
<key>key</key>
|
||||||
<string>kCustomDarkColor</string>
|
<string>kCustomDarkColor</string>
|
||||||
<key>PostNotification</key>
|
<key>PostNotification</key>
|
||||||
<string>com.mac-user669.zenithdark.prefschanged</string>
|
<string>com.mac-user669.zenithdark.prefschanged</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>cell</key>
|
||||||
|
<string>PSGroupCell</string>
|
||||||
|
<key>label</key>
|
||||||
|
<string></string>
|
||||||
|
<key>footerText</key>
|
||||||
|
<string>Default: #FFFFFF:0.7</string>
|
||||||
|
</dict>
|
||||||
|
|
||||||
|
<dict>
|
||||||
|
<key>cell</key>
|
||||||
|
<string>PSLinkCell</string>
|
||||||
|
<key>cellClass</key>
|
||||||
|
<string>SparkColourPickerCell</string>
|
||||||
|
<key>libsparkcolourpicker</key>
|
||||||
|
<dict>
|
||||||
|
<key>defaults</key>
|
||||||
|
<string>com.mac-user669.zenithdark</string>
|
||||||
|
<key>key</key>
|
||||||
|
<string>kCustomLightColor</string>
|
||||||
|
<key>fallback</key>
|
||||||
|
<string>#FFFFFF:0.7</string>
|
||||||
|
<key>alpha</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
<key>label</key>
|
||||||
|
<string>Light Color</string>
|
||||||
|
<key>key</key>
|
||||||
|
<string>kCustomLightColor</string>
|
||||||
|
<key>PostNotification</key>
|
||||||
|
<string>com.mac-user669.zenithdark.prefschanged</string>
|
||||||
|
</dict>
|
||||||
|
|
||||||
<dict>
|
<dict>
|
||||||
<key>cell</key>
|
<key>cell</key>
|
||||||
@ -133,7 +166,7 @@
|
|||||||
<key>title</key>
|
<key>title</key>
|
||||||
<string>Reset</string>
|
<string>Reset</string>
|
||||||
<key>prompt</key>
|
<key>prompt</key>
|
||||||
<string>Reset all settings?</string>
|
<string>Reset settings?</string>
|
||||||
<key>okTitle</key>
|
<key>okTitle</key>
|
||||||
<string>Reset</string>
|
<string>Reset</string>
|
||||||
<key>cancelTitle</key>
|
<key>cancelTitle</key>
|
||||||
|
Reference in New Issue
Block a user