diff --git a/Tweak.xm b/Tweak.xm
index 7124c80..7ed6d52 100644
--- a/Tweak.xm
+++ b/Tweak.xm
@@ -4,7 +4,6 @@
Dark Mode for Zenith's Grabber view!
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.
-
Written for Cooper Hull, @mac-user669.
*/
@@ -16,6 +15,14 @@ Written for Cooper Hull, @mac-user669.
-(void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
%orig(previousTraitCollection);
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 (@available(iOS 13, *)) {
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
@@ -23,7 +30,7 @@ Written for Cooper Hull, @mac-user669.
}
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.
-}
+}
\ No newline at end of file
diff --git a/ZenithDark.h b/ZenithDark.h
index 7a80d81..37bbb8a 100644
--- a/ZenithDark.h
+++ b/ZenithDark.h
@@ -36,6 +36,7 @@ NSMutableDictionary *prefs;
// 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 kColor1 [UIColor redColor]
+#define kColor1 [UIColor redColor] // Color used for testing
+
// the PLIST path where all user settings are stored.
#define PLIST_PATH @"/var/mobile/Library/Preferences/com.mac-user669.zenithdark.plist"
diff --git a/zenithdarkprefs/Resources/Root.plist b/zenithdarkprefs/Resources/Root.plist
index 370f4c8..c05f6f1 100644
--- a/zenithdarkprefs/Resources/Root.plist
+++ b/zenithdarkprefs/Resources/Root.plist
@@ -49,6 +49,7 @@
footerText
Default: #000000:0.44
+
cell
PSLinkCell
@@ -66,12 +67,44 @@
label
- Color
+ Dark Color
key
kCustomDarkColor
PostNotification
com.mac-user669.zenithdark.prefschanged
+
+ cell
+ PSGroupCell
+ label
+
+ footerText
+ Default: #FFFFFF:0.7
+
+
+
+ cell
+ PSLinkCell
+ cellClass
+ SparkColourPickerCell
+ libsparkcolourpicker
+
+ defaults
+ com.mac-user669.zenithdark
+ key
+ kCustomLightColor
+ fallback
+ #FFFFFF:0.7
+ alpha
+
+
+ label
+ Light Color
+ key
+ kCustomLightColor
+ PostNotification
+ com.mac-user669.zenithdark.prefschanged
+
cell
@@ -133,7 +166,7 @@
title
Reset
prompt
- Reset all settings?
+ Reset settings?
okTitle
Reset
cancelTitle