From 633ae14fa1448330e58b12160dd0be35f78c1d57 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 5 Nov 2013 00:23:45 +0400 Subject: Colors --- .gitignore | 1 + Juick.xcodeproj/project.pbxproj | 6 ++++++ Juick/AppDelegate.m | 9 +++++---- Juick/Colors.h | 18 ++++++++++++++++++ Juick/Colors.m | 29 +++++++++++++++++++++++++++++ Juick/MessagesViewController.m | 5 +++-- Juick/RevealPanelViewController.m | 7 ++++--- 7 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 Juick/Colors.h create mode 100644 Juick/Colors.m diff --git a/.gitignore b/.gitignore index 1f9ae16..fcb5678 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ xcuserdata +xcshareddata Pods/* diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj index 0b5eb79..0755bda 100644 --- a/Juick.xcodeproj/project.pbxproj +++ b/Juick.xcodeproj/project.pbxproj @@ -26,6 +26,7 @@ 77C67EDF182827DB00427098 /* reveal-icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 77C67EDD182827DB00427098 /* reveal-icon@2x.png */; }; 77C67EE21828288C00427098 /* RevealPanelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C67EE11828288C00427098 /* RevealPanelViewController.m */; }; 77C67EE51828342000427098 /* NSURL+PathParameters.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C67EE41828342000427098 /* NSURL+PathParameters.m */; }; + 77C67EE81828379700427098 /* Colors.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C67EE71828379700427098 /* Colors.m */; }; 77D163C2181F048F00401EF0 /* MessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 77D163C1181F048F00401EF0 /* MessageCell.m */; }; /* End PBXBuildFile section */ @@ -66,6 +67,8 @@ 77C67EE11828288C00427098 /* RevealPanelViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RevealPanelViewController.m; sourceTree = ""; }; 77C67EE31828342000427098 /* NSURL+PathParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURL+PathParameters.h"; sourceTree = ""; }; 77C67EE41828342000427098 /* NSURL+PathParameters.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURL+PathParameters.m"; sourceTree = ""; }; + 77C67EE61828379700427098 /* Colors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Colors.h; sourceTree = ""; }; + 77C67EE71828379700427098 /* Colors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Colors.m; sourceTree = ""; }; 77D163C0181F048F00401EF0 /* MessageCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageCell.h; sourceTree = ""; }; 77D163C1181F048F00401EF0 /* MessageCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageCell.m; sourceTree = ""; }; AD52EBAFFD6B4395B342F246 /* Pods-Juick.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Juick.xcconfig"; path = "Pods/Pods-Juick.xcconfig"; sourceTree = ""; }; @@ -148,6 +151,8 @@ 77A09549181F1F25002BDECD /* Message.m */, 77C67EE01828288C00427098 /* RevealPanelViewController.h */, 77C67EE11828288C00427098 /* RevealPanelViewController.m */, + 77C67EE61828379700427098 /* Colors.h */, + 77C67EE71828379700427098 /* Colors.m */, ); path = Juick; sourceTree = ""; @@ -319,6 +324,7 @@ 77A0954A181F1F25002BDECD /* Message.m in Sources */, 77317BC2181BBE8500D60005 /* MessagesViewController.m in Sources */, 77C67EE21828288C00427098 /* RevealPanelViewController.m in Sources */, + 77C67EE81828379700427098 /* Colors.m in Sources */, 77C67EE51828342000427098 /* NSURL+PathParameters.m in Sources */, 77317BB8181BBE8500D60005 /* main.m in Sources */, ); 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