Merge branch 'dejal'

* dejal:
  #1273 (making dark themes darker)
  #1281 (iPad widget issues)
  #1279 (status bar color)
This commit is contained in:
Samuel Clay 2020-02-23 16:17:11 -05:00
commit 1f1f479c66
7 changed files with 44 additions and 10 deletions

View file

@ -214,6 +214,15 @@
} completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
// leftBorder.frame = CGRectMake(0, 0, 1, CGRectGetHeight(self.view.bounds));
CGFloat currentMasterWidth = self.masterNavigationController.view.frame.size.width;
BOOL isInvalid = currentMasterWidth < 100.0;
if (isInvalid) {
NSLog(@"Invalid width detected: %@; correcting", @(currentMasterWidth)); // log
self.masterNavigationController.view.frame = CGRectMake(0, 0, self.masterWidth, self.view.bounds.size.height);
}
if (!self.feedDetailIsVisible) {
[self adjustLayoutCompleted:YES];
}

View file

@ -1878,6 +1878,8 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
[ThemeManager themeManager].themeCSSSuffix];
[self.webView stringByEvaluatingJavaScriptFromString:jsString];
self.webView.backgroundColor = UIColorFromLightDarkRGB(0x707070, 0x404040);
}
- (BOOL)canHideNavigationBar {

View file

@ -782,9 +782,9 @@
[super updateTheme];
self.navigationController.navigationBar.tintColor = [UINavigationBar appearance].tintColor;
self.navigationController.navigationBar.barTintColor = [UINavigationBar appearance].barTintColor;
self.navigationController.navigationBar.barTintColor = UIColorFromLightSepiaMediumDarkRGB(0xE3E6E0, 0xFFFFC5, 0x222222, 0x111111);
self.navigationController.navigationBar.backgroundColor = [UINavigationBar appearance].backgroundColor;
self.view.backgroundColor = UIColorFromRGB(0xe0e0e0);
self.view.backgroundColor = UIColorFromLightDarkRGB(0xe0e0e0, 0x111111);
[self updateAutoscrollButtons];
[self updateTraverseBackground];

View file

@ -22,6 +22,24 @@ NSString * const ThemeStyleSepia = @"sepia";
NSString * const ThemeStyleMedium = @"medium";
NSString * const ThemeStyleDark = @"dark";
@interface UINavigationController (Theme)
@end
@implementation UINavigationController (Theme)
- (UIStatusBarStyle)preferredStatusBarStyle {
if ([ThemeManager themeManager].isDarkTheme) {
return UIStatusBarStyleLightContent;
} else if (@available(iOS 13.0, *)) {
return UIStatusBarStyleDarkContent;
} else {
return UIStatusBarStyleDefault;
}
}
@end
@interface ThemeManager ()
@property (nonatomic, readonly) NewsBlurAppDelegate *appDelegate;
@ -171,9 +189,9 @@ NSString * const ThemeStyleDark = @"dark";
if (rgbValue == 0x8F918B) {
return [UIColor colorWithWhite:0.7 alpha:1.0];
} else if (red < 0.5 && green < 0.5 && blue < 0.5) {
return [UIColor colorWithRed:1.0 - red green:1.0 - green blue:1.0 - blue alpha:1.0];
return [UIColor colorWithRed:1.2 - red green:1.2 - green blue:1.2 - blue alpha:1.0];
} else {
return [UIColor colorWithRed:red - 0.5 green:green - 0.5 blue:blue - 0.5 alpha:1.0];
return [UIColor colorWithRed:red - 0.7 green:green - 0.7 blue:blue - 0.7 alpha:1.0];
}
} else if ([theme isEqualToString:ThemeStyleSepia]) {
CGFloat outputRed = (red * 0.393) + (green * 0.769) + (blue * 0.189);
@ -261,8 +279,9 @@ NSString * const ThemeStyleDark = @"dark";
- (void)setupTheme {
[UINavigationBar appearance].tintColor = UIColorFromLightSepiaMediumDarkRGB(0x0, 0x0, 0x9a8f73, 0x9a8f73);
[UINavigationBar appearance].barTintColor = UIColorFromLightSepiaMediumDarkRGB(0xE3E6E0, 0xFFFFC5, 0x4A4A4A, 0x222222);
[UINavigationBar appearance].backgroundColor = UIColorFromLightSepiaMediumDarkRGB(0xE3E6E0, 0xFFFFC5, 0x4A4A4A, 0x222222);
[UINavigationBar appearance].barTintColor = UIColorFromLightSepiaMediumDarkRGB(0xE3E6E0, 0xFFFFC5, 0x333333, 0x222222);
[UINavigationBar appearance].backgroundColor = UIColorFromLightSepiaMediumDarkRGB(0xE3E6E0, 0xFFFFC5, 0x333333, 0x222222);
[UINavigationBar appearance].titleTextAttributes = @{NSForegroundColorAttributeName : UIColorFromLightSepiaMediumDarkRGB(0x8F918B, 0x8F918B, 0x8F918B, 0x8F918B)};
[UIToolbar appearance].barTintColor = UIColorFromLightSepiaMediumDarkRGB(0xE3E6E0, 0xFFFFC5, 0x4A4A4A, 0x222222);
[UISegmentedControl appearance].tintColor = UIColorFromLightSepiaMediumDarkRGB(0x8F918B, 0x8F918B, 0x8F918B, 0x8F918B);
@ -271,6 +290,8 @@ NSString * const ThemeStyleDark = @"dark";
[UINavigationBar appearance].barStyle = style;
[UINavigationBar appearance].translucent = YES;
self.appDelegate.navigationController.navigationBar.barStyle = style;
[self.appDelegate.navigationController setNeedsStatusBarAppearanceUpdate];
}
- (void)updateTheme {

View file

@ -212,6 +212,8 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>

View file

@ -8,7 +8,7 @@
body {
color: #aaaaaa;
background-color: #202020;
background-color: #000000;
}
/* ========== */
@ -17,7 +17,7 @@ body {
.NB-header {
color: #bbbbbb;
background-image: -webkit-gradient(linear, left top, left bottom, from(#444444), to(#222222));
background-image: -webkit-gradient(linear, left top, left bottom, from(#333333), to(#111111));
border-bottom: 1px solid #333532;
text-shadow: 0 1px 0 rgba(28, 28, 28, .1);

View file

@ -8,7 +8,7 @@
body {
color: #eeeeee;
background-color: gray;
background-color: #444444;
}
/* ========== */
@ -17,7 +17,7 @@ body {
.NB-header {
color: #bbbbbb;
background-image: -webkit-gradient(linear, left top, left bottom, from(#777777), to(#606060));
background-image: -webkit-gradient(linear, left top, left bottom, from(#606060), to(#404040));
border-bottom: 1px solid #535353;
text-shadow: 0 1px 0 rgba(28, 28, 28, .1);