From 5ea3dc91c3619e7525da770eb2d124bb3b5f9875 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 2 Oct 2019 23:28:08 +0300 Subject: Fix Dark Mode --- Juick/AppDelegate.m | 2 +- .../Colors.xcassets/Background.colorset/Contents.json | 18 ++++++++++++++++++ Juick/Colors.xcassets/Muted.colorset/Contents.json | 18 ++++++++++++++++++ Juick/Colors.xcassets/Text.colorset/Contents.json | 18 ++++++++++++++++++ Juick/Views/BubbleMessageCell.m | 2 +- Juick/Views/MessageCell.m | 9 +++++---- Juick/Views/QuoteView.m | 2 +- 7 files changed, 62 insertions(+), 7 deletions(-) diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m index fe1b0eb..d4c2304 100644 --- a/Juick/AppDelegate.m +++ b/Juick/AppDelegate.m @@ -29,7 +29,7 @@ NSString * const UserUpdatedNotificationName = @"UserUpdated"; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[UINavigationBar appearance] setTintColor:[UIColor colorNamed:@"Title"]]; - [[UINavigationBar appearance] setBarTintColor:[UIColor whiteColor]]; + [[UINavigationBar appearance] setBarTintColor:[UIColor colorNamed:@"Background"]]; [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor colorNamed:@"Muted"]}]; [[UINavigationBar appearance] setLargeTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor colorNamed:@"Muted"]}]; [[UIToolbar appearance] setTintColor:[UIColor colorNamed:@"Title"]]; diff --git a/Juick/Colors.xcassets/Background.colorset/Contents.json b/Juick/Colors.xcassets/Background.colorset/Contents.json index 53e5f34..09356b7 100644 --- a/Juick/Colors.xcassets/Background.colorset/Contents.json +++ b/Juick/Colors.xcassets/Background.colorset/Contents.json @@ -15,6 +15,24 @@ "green" : "0xFD" } } + }, + { + "idiom" : "universal", + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0.133", + "alpha" : "1.000", + "blue" : "0.133", + "green" : "0.133" + } + } } ] } \ No newline at end of file diff --git a/Juick/Colors.xcassets/Muted.colorset/Contents.json b/Juick/Colors.xcassets/Muted.colorset/Contents.json index 679b256..b6eae04 100644 --- a/Juick/Colors.xcassets/Muted.colorset/Contents.json +++ b/Juick/Colors.xcassets/Muted.colorset/Contents.json @@ -15,6 +15,24 @@ "green" : "0x95" } } + }, + { + "idiom" : "universal", + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0.754", + "alpha" : "1.000", + "blue" : "0.754", + "green" : "0.754" + } + } } ] } \ No newline at end of file diff --git a/Juick/Colors.xcassets/Text.colorset/Contents.json b/Juick/Colors.xcassets/Text.colorset/Contents.json index ee1c5bc..f8b843c 100644 --- a/Juick/Colors.xcassets/Text.colorset/Contents.json +++ b/Juick/Colors.xcassets/Text.colorset/Contents.json @@ -15,6 +15,24 @@ "green" : "0x22" } } + }, + { + "idiom" : "universal", + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "1.000", + "alpha" : "1.000", + "blue" : "1.000", + "green" : "1.000" + } + } } ] } \ No newline at end of file diff --git a/Juick/Views/BubbleMessageCell.m b/Juick/Views/BubbleMessageCell.m index f889200..53c4b2c 100644 --- a/Juick/Views/BubbleMessageCell.m +++ b/Juick/Views/BubbleMessageCell.m @@ -23,7 +23,7 @@ } -(void) configureWithMessage:(Message *)message isMe:(BOOL)isMe { - self.message.backgroundColor = isMe ? [UIColor colorNamed:@"Funny"] : [UIColor colorNamed:@"Chat"]; + self.message.backgroundColor = isMe ? [UIColor colorNamed:@"Funny"] : [UIColor colorNamed:@"Background"]; self.message.textColor = isMe ? [UIColor whiteColor] : [UIColor colorNamed:@"Text"]; self.message.dataDetectorTypes = UIDataDetectorTypeAll; self.message.tintColor = isMe? [UIColor whiteColor] : [UIColor colorNamed:@"Title"]; diff --git a/Juick/Views/MessageCell.m b/Juick/Views/MessageCell.m index 90d4ae2..c3a8afd 100644 --- a/Juick/Views/MessageCell.m +++ b/Juick/Views/MessageCell.m @@ -22,7 +22,6 @@ const NSString *unreadMarker = @"●"; - (void)awakeFromNib { [super awakeFromNib]; - self.text.textColor = [UIColor colorNamed:@"Text"]; self.text.dataDetectorTypes = UIDataDetectorTypeAll; self.text.tintColor = [UIColor colorNamed:@"Title"]; self.title.textColor = [UIColor colorNamed:@"Title"]; @@ -103,7 +102,9 @@ const NSString *unreadMarker = @"●"; [self.text setHidden:NO]; NSMutableAttributedString *txt = [[NSMutableAttributedString alloc] initWithString:msg.text - attributes:@{NSFontAttributeName:[UIFont preferredFontForTextStyle:UIFontTextStyleBody]}]; + attributes:@{NSFontAttributeName:[UIFont preferredFontForTextStyle:UIFontTextStyleBody], + NSForegroundColorAttributeName:[UIColor colorNamed:@"Text"] + }]; [txt beginEditing]; for (Entity *entity in msg.entities) { NSUInteger start = entity.start ? [entity.start unsignedIntegerValue] : 0; @@ -115,7 +116,7 @@ const NSString *unreadMarker = @"●"; [txt addAttribute:NSLinkAttributeName value:entity.link range:currentRange]; } if ([entity.type isEqualToString:@"q"]) { - [txt addAttribute:NSForegroundColorAttributeName value:[UIColor darkGrayColor] range:currentRange]; + [txt addAttribute:NSForegroundColorAttributeName value:[UIColor colorNamed:@"Muted"] range:currentRange]; [txt addAttribute:NSParagraphStyleAttributeName value:_quoteStyle range:currentRange]; } if ([entity.type isEqualToString:@"u"]) { @@ -140,7 +141,7 @@ const NSString *unreadMarker = @"●"; initWithString:tagsList attributes:@{ NSFontAttributeName:_italicFont, - NSForegroundColorAttributeName:[UIColor darkGrayColor] + NSForegroundColorAttributeName:[UIColor colorNamed:@"Muted"] }] atIndex:0]; } [txt endEditing]; diff --git a/Juick/Views/QuoteView.m b/Juick/Views/QuoteView.m index 4ff78ce..5dd3d62 100644 --- a/Juick/Views/QuoteView.m +++ b/Juick/Views/QuoteView.m @@ -11,7 +11,7 @@ -(void) awakeFromNib { [super awakeFromNib]; - self.contentView.backgroundColor = [UIColor whiteColor]; + self.contentView.backgroundColor = [UIColor colorNamed:@"Background"]; } @end -- cgit v1.2.3