1
0
mirror of https://github.com/danog/Telegram.git synced 2024-12-12 09:29:55 +01:00
Telegram/Share/TGColor.m

58 lines
1.4 KiB
Mathematica
Raw Normal View History

2015-10-01 18:19:52 +02:00
#import "TGColor.h"
UIColor *TGColorWithHex(int hex)
{
return [[UIColor alloc] initWithRed:(((hex >> 16) & 0xff) / 255.0f) green:(((hex >> 8) & 0xff) / 255.0f) blue:(((hex) & 0xff) / 255.0f) alpha:1.0f];
}
UIColor *TGColorWithHexAndAlpha(int hex, CGFloat alpha)
{
return [[UIColor alloc] initWithRed:(((hex >> 16) & 0xff) / 255.0f) green:(((hex >> 8) & 0xff) / 255.0f) blue:(((hex) & 0xff) / 255.0f) alpha:alpha];
2016-02-25 01:03:51 +01:00
}
UIColor *TGAccentColor()
{
static UIColor *color = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^
{
color = TGColorWithHex(0x007ee5);
});
return color;
}
UIColor *TGDestructiveAccentColor()
{
static UIColor *color = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^
{
color = TGColorWithHex(0xff3b30);
});
return color;
}
UIColor *TGSelectionColor()
{
static UIColor *color = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
color = TGColorWithHex(0xe4e4e4);
else
color = TGColorWithHex(0xd9d9d9);
});
return color;
}
UIColor *TGSeparatorColor()
{
static UIColor *color = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^
{
color = TGColorWithHex(0xc8c7cc);
});
return color;
2015-10-01 18:19:52 +02:00
}