session-ios/SignalUtilitiesKit/Utilities/UIColor+OWS.m

213 lines
4.6 KiB
Mathematica
Raw Permalink Normal View History

2017-02-13 18:11:41 +01:00
//
2019-02-06 22:00:22 +01:00
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
2017-02-13 18:11:41 +01:00
//
2014-11-24 21:51:43 +01:00
2018-09-25 19:09:55 +02:00
#import "UIColor+OWS.h"
2018-11-15 17:23:32 +01:00
#import "OWSMath.h"
2020-11-12 00:41:45 +01:00
#import <SignalCoreKit/Cryptography.h>
2014-11-24 21:51:43 +01:00
NS_ASSUME_NONNULL_BEGIN
@implementation UIColor (OWS)
2014-11-24 21:51:43 +01:00
2018-06-29 23:28:13 +02:00
#pragma mark -
2017-02-13 18:11:41 +01:00
+ (UIColor *)ows_signalBrandBlueColor
{
2019-06-14 07:25:39 +02:00
return UIColor.lokiGreen;
2017-02-13 18:11:41 +01:00
}
+ (UIColor *)ows_materialBlueColor
{
2019-06-14 07:25:39 +02:00
return UIColor.lokiGreen;
2014-11-24 21:51:43 +01:00
}
+ (UIColor *)ows_darkIconColor
{
2019-06-14 07:25:39 +02:00
return UIColor.lokiGreen;
}
+ (UIColor *)ows_darkGrayColor
{
2019-06-14 07:25:39 +02:00
return UIColor.lokiDarkGray;
2014-11-24 21:51:43 +01:00
}
2018-11-15 17:23:32 +01:00
+ (UIColor *)ows_darkThemeBackgroundColor
{
2019-06-14 07:25:39 +02:00
return UIColor.lokiDarkestGray;
2014-11-24 21:51:43 +01:00
}
+ (UIColor *)ows_fadedBlueColor
{
// blue: #B6DEF4
return [UIColor colorWithRed:182.f / 255.f green:222.f / 255.f blue:244.f / 255.f alpha:1.f];
}
+ (UIColor *)ows_yellowColor
{
// gold: #FFBB5C
return [UIColor colorWithRed:245.f / 255.f green:186.f / 255.f blue:98.f / 255.f alpha:1.f];
}
+ (UIColor *)ows_reminderYellowColor
{
return [UIColor colorWithRed:252.f / 255.f green:240.f / 255.f blue:217.f / 255.f alpha:1.f];
}
+ (UIColor *)ows_reminderDarkYellowColor
{
return [UIColor colorWithRGBHex:0xFCDA91];
}
+ (UIColor *)ows_destructiveRedColor
{
2018-07-05 23:27:37 +02:00
return [UIColor colorWithRGBHex:0xF44336];
}
+ (UIColor *)ows_errorMessageBorderColor
{
return [UIColor colorWithRed:195.f / 255.f green:0 blue:22.f / 255.f alpha:1.0f];
}
+ (UIColor *)ows_infoMessageBorderColor
{
return [UIColor colorWithRed:239.f / 255.f green:189.f / 255.f blue:88.f / 255.f alpha:1.0f];
}
+ (UIColor *)ows_lightBackgroundColor
{
return [UIColor colorWithRed:242.f / 255.f green:242.f / 255.f blue:242.f / 255.f alpha:1.f];
}
+ (UIColor *)ows_systemPrimaryButtonColor
{
return UIColor.lokiGreen;
}
2018-06-01 20:20:48 +02:00
+ (UIColor *)ows_messageBubbleLightGrayColor
{
return [UIColor colorWithHue:240.0f / 360.0f saturation:0.02f brightness:0.92f alpha:1.0f];
}
+ (UIColor *)colorWithRGBHex:(unsigned long)value
{
CGFloat red = ((value >> 16) & 0xff) / 255.f;
CGFloat green = ((value >> 8) & 0xff) / 255.f;
CGFloat blue = ((value >> 0) & 0xff) / 255.f;
return [UIColor colorWithRed:red green:green blue:blue alpha:1.f];
}
- (UIColor *)blendWithColor:(UIColor *)otherColor alpha:(CGFloat)alpha
{
CGFloat r0, g0, b0, a0;
2017-05-12 15:22:56 +02:00
#ifdef DEBUG
BOOL result =
#endif
[self getRed:&r0 green:&g0 blue:&b0 alpha:&a0];
OWSAssertDebug(result);
2017-05-12 15:22:56 +02:00
2017-05-12 15:49:12 +02:00
CGFloat r1, g1, b1, a1;
2017-05-12 15:22:56 +02:00
#ifdef DEBUG
result =
#endif
[otherColor getRed:&r1 green:&g1 blue:&b1 alpha:&a1];
OWSAssertDebug(result);
2017-05-12 15:49:12 +02:00
2019-02-06 22:00:22 +01:00
alpha = CGFloatClamp01(alpha);
2017-05-12 15:49:12 +02:00
return [UIColor colorWithRed:CGFloatLerp(r0, r1, alpha)
green:CGFloatLerp(g0, g1, alpha)
blue:CGFloatLerp(b0, b1, alpha)
alpha:CGFloatLerp(a0, a1, alpha)];
}
#pragma mark - Color Palette
2018-06-27 23:35:20 +02:00
2018-06-28 15:57:49 +02:00
+ (UIColor *)ows_signalBlueColor
2018-06-27 23:35:20 +02:00
{
return [UIColor colorWithRGBHex:0x2090EA];
}
2018-06-28 15:57:49 +02:00
+ (UIColor *)ows_greenColor
2018-06-27 23:35:20 +02:00
{
return [UIColor colorWithRGBHex:0x4caf50];
}
2018-06-28 15:57:49 +02:00
+ (UIColor *)ows_redColor
2018-06-27 23:35:20 +02:00
{
return [UIColor colorWithRGBHex:0xf44336];
}
2018-09-19 16:08:27 +02:00
#pragma mark - GreyScale
2018-06-28 15:57:49 +02:00
+ (UIColor *)ows_whiteColor
2018-06-27 23:35:20 +02:00
{
return [UIColor colorWithRGBHex:0xFFFFFF];
}
2018-09-19 16:08:27 +02:00
+ (UIColor *)ows_gray02Color
2018-06-27 23:35:20 +02:00
{
2018-09-19 16:08:27 +02:00
return [UIColor colorWithRGBHex:0xF8F9F9];
2018-06-27 23:35:20 +02:00
}
2018-09-19 16:08:27 +02:00
+ (UIColor *)ows_gray05Color
2018-06-27 23:35:20 +02:00
{
return [UIColor colorWithRGBHex:0xEEEFEF];
}
2018-09-19 16:08:27 +02:00
+ (UIColor *)ows_gray25Color
2018-06-27 23:35:20 +02:00
{
2018-09-19 16:08:27 +02:00
return [UIColor colorWithRGBHex:0xBBBDBE];
2018-06-27 23:35:20 +02:00
}
2018-09-19 16:08:27 +02:00
+ (UIColor *)ows_gray45Color
2018-06-27 23:35:20 +02:00
{
2018-09-19 16:08:27 +02:00
return [UIColor colorWithRGBHex:0x898A8C];
2018-06-27 23:35:20 +02:00
}
2018-09-19 16:08:27 +02:00
+ (UIColor *)ows_gray60Color
2018-06-27 23:35:20 +02:00
{
2018-09-19 16:08:27 +02:00
return [UIColor colorWithRGBHex:0x636467];
2018-06-27 23:35:20 +02:00
}
2018-09-19 16:08:27 +02:00
+ (UIColor *)ows_gray75Color
2018-06-27 23:35:20 +02:00
{
2018-09-19 16:08:27 +02:00
return [UIColor colorWithRGBHex:0x3D3E44];
2018-06-27 23:35:20 +02:00
}
2018-09-19 16:08:27 +02:00
+ (UIColor *)ows_gray90Color
2018-06-27 23:35:20 +02:00
{
2018-09-19 16:08:27 +02:00
return [UIColor colorWithRGBHex:0x17191D];
2018-06-27 23:35:20 +02:00
}
2018-09-19 16:08:27 +02:00
+ (UIColor *)ows_gray95Color
2018-06-27 23:35:20 +02:00
{
2018-09-20 16:15:09 +02:00
return [UIColor colorWithRGBHex:0x0F1012];
2018-06-27 23:35:20 +02:00
}
2018-06-28 15:57:49 +02:00
+ (UIColor *)ows_blackColor
2018-06-27 23:35:20 +02:00
{
return [UIColor colorWithRGBHex:0x000000];
}
// TODO: Remove
+ (UIColor *)ows_darkSkyBlueColor
{
2018-10-12 20:23:38 +02:00
// HEX 0xc2090EA
return [UIColor colorWithRed:32.f / 255.f green:144.f / 255.f blue:234.f / 255.f alpha:1.f];
}
2019-06-14 07:25:39 +02:00
#pragma mark - Loki
2019-07-25 06:25:05 +02:00
+ (UIColor *)lokiGreen { return [UIColor colorWithRGBHex:0x78BE20]; }
2019-06-14 07:25:39 +02:00
+ (UIColor *)lokiDarkGreen { return [UIColor colorWithRGBHex:0x419B41]; }
+ (UIColor *)lokiDarkestGray { return [UIColor colorWithRGBHex:0x0A0A0A]; }
+ (UIColor *)lokiDarkerGray { return [UIColor colorWithRGBHex:0x252525]; }
+ (UIColor *)lokiDarkGray { return [UIColor colorWithRGBHex:0x313131]; }
2019-06-14 08:41:19 +02:00
+ (UIColor *)lokiGray { return [UIColor colorWithRGBHex:0x363636]; }
2019-06-14 07:25:39 +02:00
+ (UIColor *)lokiLightGray { return [UIColor colorWithRGBHex:0x414141]; }
2019-06-17 08:20:09 +02:00
+ (UIColor *)lokiLightestGray { return [UIColor colorWithRGBHex:0x818181]; }
2019-06-14 07:25:39 +02:00
2014-11-24 21:51:43 +01:00
@end
NS_ASSUME_NONNULL_END