Skip to content

Instantly share code, notes, and snippets.

@MTACS
Created February 22, 2020 17:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MTACS/77e318d883f1b96f506627ffaedb6a94 to your computer and use it in GitHub Desktop.
Save MTACS/77e318d883f1b96f506627ffaedb6a94 to your computer and use it in GitHub Desktop.
Solution to libcolorpicker not saving values
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>cell</key>
<string>PSLinkCell</string>
<key>cellClass</key>
<string>PFSimpleLiteColorCell</string>
<key>libcolorpicker</key>
<dict>
<key>defaults</key>
<string>com.mtac.tweakcolors</string> <!-- Use a different identifier here, I use original + colors: com.mtac.tweak -> com.mtac.tweakcolors -->
<key>key</key>
<string>colorKey</string> <!-- Key to be used in Tweak.xm -->
<key>fallback</key>
<string>#ffffff</string>
<key>alpha</key>
<false/>
</dict>
<key>label</key>
<string>Picker Label</string>
</dict>
</array>
</dict>
</plist>
#import <libcolorpicker.h>
NSMutableDictionary *colorDictionary = [NSMutableDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.mtac.tweakcolors.plist"]; // Replace the identifier with the one used in .plist file
%hook ClassName
- (void)setBackgroundColor:(UIColor *)arg1 { // Example method to set background color
%orig(LCPParseColorString([colorDictionary objectForKey:@"colorKey"], @"#ffffff")); // Grab color from key in color dictionary using LCPParseColorString and set a fallback color. Make sure it's the same as the fallback used in the .plist file
}
%end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment