From 8ae952ec8df2a713afeaef5960a88888e050c6fc Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 15 Oct 2017 23:47:11 +0300 Subject: WIP --- Juick/Helpers/ColorScheme.h | 1 + Juick/Helpers/ColorScheme.m | 5 ++++- Juick/Helpers/UIImage+Utils.h | 1 + Juick/Helpers/UIImage+Utils.m | 14 ++++++++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) (limited to 'Juick/Helpers') diff --git a/Juick/Helpers/ColorScheme.h b/Juick/Helpers/ColorScheme.h index de69689..3226f75 100644 --- a/Juick/Helpers/ColorScheme.h +++ b/Juick/Helpers/ColorScheme.h @@ -13,5 +13,6 @@ + (UIColor *)colorWithHex:(UInt32)col; +(UIColor *) mainBackground; ++(UIColor *) headerBackground; +(UIColor *) linkColor; @end diff --git a/Juick/Helpers/ColorScheme.m b/Juick/Helpers/ColorScheme.m index 56684a6..53cca4f 100644 --- a/Juick/Helpers/ColorScheme.m +++ b/Juick/Helpers/ColorScheme.m @@ -24,9 +24,12 @@ return [UIColor colorWithRed:(float)r/255.0f green:(float)g/255.0f blue:(float)b/255.0f alpha:1]; } ++ (UIColor *) headerBackground { + return [self colorWithHex:0xeeeee5]; +} + (UIColor *) mainBackground { - return [self colorWithHex:0xf8f8f8]; + return [self colorWithHex:0xddddd5]; } + (UIColor *) linkColor { diff --git a/Juick/Helpers/UIImage+Utils.h b/Juick/Helpers/UIImage+Utils.h index 8de91bf..d2e8b99 100644 --- a/Juick/Helpers/UIImage+Utils.h +++ b/Juick/Helpers/UIImage+Utils.h @@ -16,4 +16,5 @@ + (UIImage*)imageWithImage:(UIImage *)image fitInsideWidth:(float)width fitInsideHeight:(float)height; + (UIImage*)imageWithImage:(UIImage *)image fitOutsideWidth:(float)width fitOutsideHeight:(float)height; + (UIImage*)imageWithImage:(UIImage *)image cropToWidth:(float)width cropToHeight:(float)height; ++ (UIImage*)placeholderImageWithColor:(UIColor *)color size:(CGSize)size; @end diff --git a/Juick/Helpers/UIImage+Utils.m b/Juick/Helpers/UIImage+Utils.m index 4617c65..c209bcf 100644 --- a/Juick/Helpers/UIImage+Utils.m +++ b/Juick/Helpers/UIImage+Utils.m @@ -66,4 +66,18 @@ return img; } ++(UIImage *) placeholderImageWithColor:(UIColor *)color size:(CGSize)size { + CGRect rect = (CGRect){ + .origin = CGPointZero, + .size = size + }; + UIGraphicsBeginImageContextWithOptions(rect.size, false, 0.0f); + [color setFill]; + UIRectFill(rect); + UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + + return [[self alloc] initWithCGImage:[image CGImage]]; +} + @end -- cgit v1.2.3