Dark mode should now update with no respring!
- Dark mode should now update with no respring! - Code cleanup. - Now depends of iOS 13.0+
This commit is contained in:
1
Makefile
1
Makefile
@ -8,5 +8,6 @@ TWEAK_NAME = ZenithDark
|
|||||||
|
|
||||||
ZenithDark_FILES = Tweak.x
|
ZenithDark_FILES = Tweak.x
|
||||||
ZenithDark_CFLAGS = -fobjc-arc
|
ZenithDark_CFLAGS = -fobjc-arc
|
||||||
|
ZenithDark_FRAMEWORKS = UIKit CoreGraphics
|
||||||
|
|
||||||
include $(THEOS_MAKE_PATH)/tweak.mk
|
include $(THEOS_MAKE_PATH)/tweak.mk
|
||||||
|
52
Tweak.x
52
Tweak.x
@ -1,38 +1,46 @@
|
|||||||
// We make an interface to let Theos know that ZNGrabberAccessoryView is of type UIImageView;
|
|
||||||
@interface ZNGrabberAccessoryView : UIImageView
|
|
||||||
@end
|
|
||||||
|
|
||||||
BOOL kDarkModeEnabled;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Colorize Zenith's Grabber view with ease!
|
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).
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// We then import UIKit so we can override the color property without this Theos doesn't have a clue what those properties are.
|
#import "ZenithDark.h"
|
||||||
@import UIKit;
|
|
||||||
|
|
||||||
|
// We then hook the class in this case Zenith's grabber view is called “ZNGrabberAccessoryView”
|
||||||
//We then hook the class in this case Zenith's grabber view is called “ZNGrabberAccessoryView”
|
|
||||||
%hook ZNGrabberAccessoryView
|
%hook ZNGrabberAccessoryView
|
||||||
// the method we then modify is this method that is called from UIImageView to set the backgroundColor of the image view.
|
|
||||||
|
// this is called when iOS 13's dark mode is enabled!
|
||||||
|
-(void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
|
||||||
|
%orig(previousTraitCollection);
|
||||||
|
if (@available(iOS 13, *)) {
|
||||||
|
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
|
||||||
|
[self setBackgroundColor:kDarkModeColor];
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
[self setBackgroundColor:kLightModeColor];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// the method we modify is this method that is called from UIImageView to set the backgroundColor of the image view.
|
||||||
// Since the grabber view is of type UIImageView we can modify this method :)
|
// Since the grabber view is of type UIImageView we can modify this method :)
|
||||||
|
|
||||||
-(void)setBackgroundColor:(UIColor *)backgroundColor {
|
-(void)setBackgroundColor:(UIColor *)backgroundColor {
|
||||||
//call the original function then pass our custom argument to the backgroundColor argument as shown below.
|
// by default have our tweak overide this.
|
||||||
kDarkModeEnabled = ([UITraitCollection currentTraitCollection].userInterfaceStyle == UIUserInterfaceStyleDark);
|
if (@available(iOS 13, *)) {
|
||||||
if (kDarkModeEnabled) {
|
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
|
||||||
%orig([UIColor colorWithWhite:0.0 alpha:0.44]);
|
%orig(kDarkModeColor);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
%orig;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
else {
|
||||||
|
%orig;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need to make sure we tell theos that we are finished hooking this class not doing so with cause the end of the world :P
|
// we need to make sure we tell theos that we are finished hooking this class not doing so with cause the end of the world :P
|
||||||
|
26
ZenithDark.h
Normal file
26
ZenithDark.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
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).
|
||||||
|
|
||||||
|
ZenithDark Header file to keep the tweak.x file clean!
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// We then import UIKit so we can override the color property without this Theos doesn't have a clue what those properties are.
|
||||||
|
@import UIKit;
|
||||||
|
|
||||||
|
// We make an interface to let Theos know that ZNGrabberAccessoryView is of type UIImageView.
|
||||||
|
@interface ZNGrabberAccessoryView : UIImageView
|
||||||
|
@end
|
||||||
|
|
||||||
|
// Dark Zenith color we are using macros so we can call it later if need be.
|
||||||
|
#define kDarkModeColor [UIColor colorWithWhite:0.0 alpha:0.44]
|
||||||
|
|
||||||
|
// Stock Zenith color we are using macros so we can call it later if need be.
|
||||||
|
#define kLightModeColor [UIColor colorWithWhite:1.0 alpha:1.0]
|
4
control
4
control
@ -1,8 +1,8 @@
|
|||||||
Package: com.mac-user669.zenithdark
|
Package: com.mac-user669.zenithdark
|
||||||
Version: 0.0.2
|
Version: 0.0.3
|
||||||
Architecture: iphoneos-arm
|
Architecture: iphoneos-arm
|
||||||
Maintainer: mac-user669
|
Maintainer: mac-user669
|
||||||
Depends: mobilesubstrate, com.muirey03.zenith
|
Depends: mobilesubstrate, com.muirey03.zenith, firmware (>=13.0)
|
||||||
Section: Tweaks
|
Section: Tweaks
|
||||||
Description: Changes Zeniths tabs to a dark blur
|
Description: Changes Zeniths tabs to a dark blur
|
||||||
Author: mac-user669
|
Author: mac-user669
|
||||||
|
Reference in New Issue
Block a user