mirror of
				https://github.com/SoPat712/YTLitePlus.git
				synced 2025-10-30 20:34:04 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			19 lines
		
	
	
		
			738 B
		
	
	
	
		
			Objective-C
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			738 B
		
	
	
	
		
			Objective-C
		
	
	
	
	
	
| @import Alderis;
 | |
| #import "libcolorpicker.h"
 | |
| 
 | |
| UIColor *LCPParseColorString(NSString *hexString, NSString *fallback) {
 | |
| 	UIColor *result = [[UIColor alloc] initWithHbcp_propertyListValue:hexString];
 | |
| 	if (result == nil && fallback != nil) {
 | |
| 		result = [[UIColor alloc] initWithHbcp_propertyListValue:fallback];
 | |
| 	}
 | |
| 	return result;
 | |
| }
 | |
| 
 | |
| UIColor *colorFromDefaultsWithKey(NSString *identifier, NSString *key, NSString *fallback) {
 | |
| 	id result = CFBridgingRelease(CFPreferencesCopyValue((__bridge CFStringRef)key, (__bridge CFStringRef)identifier, CFSTR("mobile"), kCFPreferencesCurrentHost));
 | |
| 	if ([result isKindOfClass:NSString.class]) {
 | |
| 		return LCPParseColorString((NSString *)result, fallback);
 | |
| 	}
 | |
| 	return LCPParseColorString(fallback, nil);
 | |
| }
 | 
