Refine theme.

This commit is contained in:
Matthew Chen 2018-08-07 17:51:09 -04:00
parent 8da96e979c
commit 069c66e5e8
3 changed files with 29 additions and 18 deletions

View file

@ -27,8 +27,8 @@ NS_ASSUME_NONNULL_BEGIN
self.delegate = self;
self.backgroundColor = [UIColor ows_light02Color];
self.layer.borderColor = [UIColor.ows_blackColor colorWithAlphaComponent:0.12f].CGColor;
self.backgroundColor = (Theme.isDarkThemeEnabled ? UIColor.ows_dark95Color : UIColor.ows_light02Color);
self.layer.borderColor = [Theme.primaryColor colorWithAlphaComponent:0.12f].CGColor;
self.layer.borderWidth = 0.5f;
self.scrollIndicatorInsets = UIEdgeInsetsMake(4, 4, 4, 4);
@ -38,7 +38,7 @@ NS_ASSUME_NONNULL_BEGIN
self.userInteractionEnabled = YES;
self.font = [UIFont ows_dynamicTypeBodyFont];
self.textColor = [UIColor blackColor];
self.textColor = Theme.primaryColor;
self.textAlignment = NSTextAlignmentNatural;
self.contentMode = UIViewContentModeRedraw;
@ -48,7 +48,8 @@ NS_ASSUME_NONNULL_BEGIN
self.placeholderView = [UILabel new];
self.placeholderView.text = NSLocalizedString(@"new_message", @"");
self.placeholderView.textColor = UIColor.ows_light35Color;
self.placeholderView.textColor
= (Theme.isDarkThemeEnabled ? UIColor.ows_dark55Color : UIColor.ows_light35Color);
self.placeholderView.userInteractionEnabled = NO;
[self addSubview:self.placeholderView];

View file

@ -1,5 +1,5 @@
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "ConversationScrollButton.h"
@ -54,7 +54,6 @@ NS_ASSUME_NONNULL_BEGIN
const CGFloat circleSize = self.class.circleSize;
UIView *circleView = [UIView new];
self.circleView = circleView;
circleView.backgroundColor = [UIColor colorWithWhite:0.95f alpha:1.f];
circleView.userInteractionEnabled = NO;
circleView.layer.cornerRadius = circleSize * 0.5f;
circleView.layer.shadowColor = [UIColor colorWithWhite:0.5f alpha:1.f].CGColor;
@ -81,17 +80,28 @@ NS_ASSUME_NONNULL_BEGIN
- (void)updateColors
{
UIColor *foregroundColor;
UIColor *backgroundColor;
if (self.hasUnreadMessages) {
foregroundColor = UIColor.whiteColor;
backgroundColor = UIColor.ows_materialBlueColor;
} else if (Theme.isDarkThemeEnabled) {
foregroundColor = UIColor.ows_materialBlueColor;
backgroundColor = [UIColor colorWithWhite:0.25f alpha:1.f];
} else {
foregroundColor = UIColor.ows_materialBlueColor;
backgroundColor = [UIColor colorWithWhite:0.95f alpha:1.f];
}
const CGFloat circleSize = self.class.circleSize;
self.circleView.backgroundColor
= (self.hasUnreadMessages ? [UIColor ows_materialBlueColor] : [UIColor colorWithWhite:0.95f alpha:1.f]);
self.iconLabel.attributedText = [[NSAttributedString alloc]
initWithString:self.iconText
attributes:@{
NSFontAttributeName : [UIFont ows_fontAwesomeFont:circleSize * 0.8f],
NSForegroundColorAttributeName :
(self.hasUnreadMessages ? [UIColor whiteColor] : [UIColor ows_materialBlueColor]),
NSBaselineOffsetAttributeName : @(-0.5f),
}];
self.circleView.backgroundColor = backgroundColor;
self.iconLabel.attributedText =
[[NSAttributedString alloc] initWithString:self.iconText
attributes:@{
NSFontAttributeName : [UIFont ows_fontAwesomeFont:circleSize * 0.8f],
NSForegroundColorAttributeName : foregroundColor,
NSBaselineOffsetAttributeName : @(-0.5f),
}];
}
@end

View file

@ -141,8 +141,6 @@ import SignalMessaging
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = UIColor.white
createViews()
}
@ -150,6 +148,8 @@ import SignalMessaging
private func createViews() {
view.backgroundColor = UIColor.black
let contentView = UIView()
contentView.backgroundColor = UIColor.black
self.view.addSubview(contentView)