summaryrefslogtreecommitdiff
path: root/Juick/Helpers
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-10-15 23:47:11 +0300
committerGravatar Vitaly Takmazov2017-10-15 23:47:11 +0300
commit8ae952ec8df2a713afeaef5960a88888e050c6fc (patch)
treeb7b09deed573336e5d274eed790c30ba57e4a910 /Juick/Helpers
parent6499148cb3f62e20534b62c181125ebeacfa3438 (diff)
WIP
Diffstat (limited to 'Juick/Helpers')
-rw-r--r--Juick/Helpers/ColorScheme.h1
-rw-r--r--Juick/Helpers/ColorScheme.m5
-rw-r--r--Juick/Helpers/UIImage+Utils.h1
-rw-r--r--Juick/Helpers/UIImage+Utils.m14
4 files changed, 20 insertions, 1 deletions
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