Browse Source

Light mode color picker

master
mac-user669 4 years ago
parent
commit
fc83f55e00
3 changed files with 47 additions and 6 deletions
  1. +10
    -3
      Tweak.xm
  2. +2
    -1
      ZenithDark.h
  3. +35
    -2
      zenithdarkprefs/Resources/Root.plist

+ 10
- 3
Tweak.xm View File

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.
*/ */


-(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) {
} }


else { else {
[self setBackgroundColor:kLightColor];
[self setBackgroundColor:lightColor];
} }
} }
} }


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.


}
}

+ 2
- 1
ZenithDark.h View File

// 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"

+ 35
- 2
zenithdarkprefs/Resources/Root.plist View File

<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>
<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>
<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>

Loading…
Cancel
Save