l0stpenguin / Nightshade

A community driven darkmode for iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nightshade


Nightshade is a system wide open source darkmode for iOS with both free and premium options available, the free stuff being open source here.

Adding to the Compatability Layer


When THEOS compiles nightshade it will compile every .xm file inside of the CompatabilityLayer, by using the NightshadeColors.h file you can access the users active color pallete, and overide the universal UIKit hooks if necesarry.

There are a few partially written already for reference but the basic implementation boils down to as following;

Import the required headers

#import "../NightshadeColors.h"
#import "SparkAppList.h"

Check if app is enabled

%ctor {
	NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];

    if(GetPrefBool(@"kTweakEnabled")) {	
		if([SparkAppList doesIdentifier:@"com.dylanduff.nightshadeprefs" andKey:@"whitelistedApps" containBundleIdentifier:bundleIdentifier]){
			if ([bundleIdentifier isEqualToString:@"com.atebits.Tweetie2"]){
			   	%init(Hooks);
			}		
		}
	}

}

Run Hooks

%group Hooks

	%hook _UIBarBackground
		- (void)setBackgroundColor:(id)arg1 {
			arg1 = [UIColor cellColor];
			return %orig(arg1); 
		}
	%end

}
%end

About

A community driven darkmode for iOS


Languages

Language:Logos 55.7%Language:Objective-C 42.8%Language:Makefile 1.5%