From a778c55cd848b0d0d452a20e8eaf6a477c068ca3 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 15 Aug 2016 00:54:41 +0300 Subject: colors --- Juick/AppDelegate.m | 8 +++----- Juick/ColorScheme.h | 4 ++-- Juick/ColorScheme.m | 19 ++++++++++--------- Juick/MessagesViewController.m | 3 --- Juick/RevealPanelViewController.m | 16 +++++----------- 5 files changed, 20 insertions(+), 30 deletions(-) (limited to 'Juick') diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m index 576e11e..5fe48fe 100644 --- a/Juick/AppDelegate.m +++ b/Juick/AppDelegate.m @@ -21,13 +21,11 @@ { // style the navigation bar if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) { - [[UINavigationBar appearance] setBarTintColor:[ColorScheme navbarBackground]]; - [[UINavigationBar appearance] setTintColor:[ColorScheme navbarFont]]; - [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [ColorScheme navbarFont]}]; + [[UINavigationBar appearance] setTintColor:[ColorScheme linkColor]]; + [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [ColorScheme linkColor]}]; } - // make the status bar white - [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent; + [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault; NSURL *baseURL = [NSURL URLWithString:@"https://api.juick.com"]; RKObjectManager *objectManager = [RKObjectManager managerWithBaseURL:baseURL]; diff --git a/Juick/ColorScheme.h b/Juick/ColorScheme.h index 275962c..de69689 100644 --- a/Juick/ColorScheme.h +++ b/Juick/ColorScheme.h @@ -10,8 +10,8 @@ @interface ColorScheme : NSObject -+(UIColor *) navbarBackground; ++ (UIColor *)colorWithHex:(UInt32)col; + +(UIColor *) mainBackground; -+(UIColor *) navbarFont; +(UIColor *) linkColor; @end diff --git a/Juick/ColorScheme.m b/Juick/ColorScheme.m index 257cc72..8417489 100644 --- a/Juick/ColorScheme.m +++ b/Juick/ColorScheme.m @@ -15,21 +15,22 @@ [super initialize]; } +// takes 0x123456 ++ (UIColor *)colorWithHex:(UInt32)col { + unsigned char r, g, b; + b = col & 0xFF; + g = (col >> 8) & 0xFF; + r = (col >> 16) & 0xFF; + return [UIColor colorWithRed:(float)r/255.0f green:(float)g/255.0f blue:(float)b/255.0f alpha:1]; +} + + (UIColor *) mainBackground { return [UIColor colorWithRed:238/255.0f green:238/255.0f blue:229/255.0f alpha:1.0f]; } + (UIColor *) linkColor { - return [UIColor colorWithRed:0/255.0f green:102/255.0f blue:153/255.0f alpha:1.0f]; -} - -+ (UIColor *) navbarBackground { - return [UIColor colorWithRed:51/255.0f green:51/255.0f blue:51/255.0f alpha:1.0f]; -} - -+ (UIColor *) navbarFont { - return [UIColor colorWithRed:153/255.0f green:154/255.0f blue:153/255.0f alpha:1.0f]; + return [self colorWithHex:0x006699]; } diff --git a/Juick/MessagesViewController.m b/Juick/MessagesViewController.m index 24b8185..fe2c14d 100644 --- a/Juick/MessagesViewController.m +++ b/Juick/MessagesViewController.m @@ -72,9 +72,6 @@ static NSString *CellIdentifier = @"MessageCell"; // TODO: add to thread view too [self.view addGestureRecognizer:[revealController panGestureRecognizer]]; } - if (NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_6_1) { - self.navigationController.navigationBar.tintColor = [ColorScheme navbarBackground]; - } [self.tableView registerNib:[UINib nibWithNibName:@"MessageCell" bundle:nil] forCellReuseIdentifier:CellIdentifier]; self.tableView.rowHeight = UITableViewAutomaticDimension; diff --git a/Juick/RevealPanelViewController.m b/Juick/RevealPanelViewController.m index 1e9fb7b..d890f97 100644 --- a/Juick/RevealPanelViewController.m +++ b/Juick/RevealPanelViewController.m @@ -38,13 +38,9 @@ static NSString *CellIdentifier = @"NavCell"; - (void)viewDidLoad { [super viewDidLoad]; - - if (NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_6_1) { - self.navigationController.navigationBar.tintColor = [ColorScheme navbarBackground]; - } - [self.view setBackgroundColor:[ColorScheme navbarBackground]]; + [self.view setBackgroundColor:[ColorScheme mainBackground]]; self.tableView = [[UITableView alloc] init]; - [self.tableView setBackgroundColor:[ColorScheme navbarBackground]]; + [self.tableView setBackgroundColor:[ColorScheme mainBackground]]; self.tableView.delegate = self; self.tableView.dataSource = self; [self.tableView setSeparatorInset:UIEdgeInsetsZero]; @@ -114,12 +110,10 @@ static NSString *CellIdentifier = @"NavCell"; - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NavCell * cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; NSInteger row = indexPath.row; - [cell.contentView setBackgroundColor:[ColorScheme navbarBackground]]; + [cell.contentView setBackgroundColor:[UIColor whiteColor]]; cell.icon.font = [UIFont fontWithName:kFontAwesomeFamilyName size:32.f]; - cell.icon.textColor = [ColorScheme navbarFont]; - //cell.iconLabel.backgroundColor = [ColorScheme navbarBackground]; - //cell.descriptionTextLabel.backgroundColor = [ColorScheme navbarBackground]; - cell.descriptionText.textColor = [ColorScheme navbarFont]; + cell.icon.textColor = [ColorScheme linkColor]; + cell.descriptionText.textColor = [ColorScheme linkColor]; if (row == 0) { cell.descriptionText.text = @"My feed"; cell.icon.text = [NSString fontAwesomeIconStringForEnum:FAIconHome]; -- cgit v1.2.3