From 633ae14fa1448330e58b12160dd0be35f78c1d57 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 5 Nov 2013 00:23:45 +0400 Subject: Colors --- Juick/AppDelegate.m | 9 +++++---- Juick/Colors.h | 18 ++++++++++++++++++ Juick/Colors.m | 29 +++++++++++++++++++++++++++++ Juick/MessagesViewController.m | 5 +++-- Juick/RevealPanelViewController.m | 7 ++++--- 5 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 Juick/Colors.h create mode 100644 Juick/Colors.m (limited to 'Juick') diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m index 3fa3030..aa00698 100644 --- a/Juick/AppDelegate.m +++ b/Juick/AppDelegate.m @@ -11,15 +11,16 @@ #import "RevealPanelViewController.h" #import "SWRevealViewController.h" +#import "Colors.h" + @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // style the navigation bar - UIColor* navColor = [UIColor colorWithRed:44/255.0f green:44/255.0f blue:44/255.0f alpha:1]; - [[UINavigationBar appearance] setBarTintColor:navColor]; - [[UINavigationBar appearance] setTintColor:[UIColor colorWithRed:153/255.0f green:154/255.0f blue:153/255.0f alpha:1]]; - [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor colorWithRed:153/255.0f green:154/255.0f blue:153/255.0f alpha:1]}]; + [[UINavigationBar appearance] setBarTintColor:[Colors navbarBackground]]; + [[UINavigationBar appearance] setTintColor:[Colors navbarFont]]; + [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [Colors navbarFont]}]; // make the status bar white [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent; diff --git a/Juick/Colors.h b/Juick/Colors.h new file mode 100644 index 0000000..bd9d260 --- /dev/null +++ b/Juick/Colors.h @@ -0,0 +1,18 @@ +// +// Colors.h +// Juick +// +// Created by Vitaly Takmazov on 05.11.13. +// Copyright (c) 2013 com.juick. All rights reserved. +// + +#import + +@interface Colors : NSObject + ++(UIColor *) navbarBackground; ++(UIColor *) mainBackground; ++(UIColor *) navbarFont; ++(UIColor *) linkColor; + +@end diff --git a/Juick/Colors.m b/Juick/Colors.m new file mode 100644 index 0000000..1a64e3d --- /dev/null +++ b/Juick/Colors.m @@ -0,0 +1,29 @@ +// +// Colors.m +// Juick +// +// Created by Vitaly Takmazov on 05.11.13. +// Copyright (c) 2013 com.juick. All rights reserved. +// + +#import "Colors.h" + +@implementation Colors + ++ (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:44/255.0f green:44/255.0f blue:44/255.0f alpha:1]; +} + ++ (UIColor *) navbarFont { + return [UIColor colorWithRed:153/255.0f green:154/255.0f blue:153/255.0f alpha:1]; +} + +@end diff --git a/Juick/MessagesViewController.m b/Juick/MessagesViewController.m index 19eebf4..72cd0be 100644 --- a/Juick/MessagesViewController.m +++ b/Juick/MessagesViewController.m @@ -13,6 +13,7 @@ #import "MessageCell.h" #import "Message.h" +#import "Colors.h" #import "NSURL+PathParameters.h" @@ -92,7 +93,7 @@ static NSString *CellIdentifier = @"MessageCell"; [super viewDidLoad]; self.dataLoading = NO; self.title = @"Discover"; - [self.view setBackgroundColor:[UIColor colorWithRed:238/255.0f green:238/255.0f blue:229/255.0f alpha:1.0f]]; + [self.view setBackgroundColor:[Colors mainBackground]]; SWRevealViewController *revealController = [self revealViewController]; [self.navigationController.navigationBar addGestureRecognizer:revealController.panGestureRecognizer]; UIBarButtonItem *revealButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"reveal-icon.png"] @@ -154,7 +155,7 @@ static NSString *CellIdentifier = @"MessageCell"; Message *msg = [_messages objectAtIndex:indexPath.row]; [cell.avatar setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://i.juick.com/as/%@.png", msg.userID]]]]]; cell.titleLabel.text = msg.user; - cell.titleLabel.textColor = [UIColor colorWithRed:0 green:102/255.0f blue:153/255.0f alpha:1.0f]; + cell.titleLabel.textColor = [Colors linkColor]; cell.bodyLabel.text = msg.text; [cell setBackgroundColor:[UIColor whiteColor]]; [cell setNeedsUpdateConstraints]; diff --git a/Juick/RevealPanelViewController.m b/Juick/RevealPanelViewController.m index 3381e28..67f1a08 100644 --- a/Juick/RevealPanelViewController.m +++ b/Juick/RevealPanelViewController.m @@ -8,6 +8,8 @@ #import "RevealPanelViewController.h" +#import "Colors.h" + @interface RevealPanelViewController () @end @@ -27,7 +29,7 @@ { [super viewDidLoad]; self.title = @"Juick"; - [self.view setBackgroundColor:[UIColor colorWithRed:238/255.0f green:238/255.0f blue:229/255.0f alpha:1.0f]]; + [self.view setBackgroundColor:[Colors mainBackground]]; } - (void)didReceiveMemoryWarning @@ -51,8 +53,7 @@ NSInteger row = indexPath.row; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; - [cell setBackgroundColor:[UIColor colorWithRed:236/255.0f green:237/255.0f blue:227/255.0f alpha:1]]; - cell.textLabel.textColor = [UIColor colorWithRed:0 green:102/255.0f blue:153/255.0f alpha:1.0f]; + cell.textLabel.textColor = [Colors linkColor]; } if (row == 0) { cell.textLabel.text = @"My feed"; -- cgit v1.2.3