168 lines
5.0 KiB
Objective-C
168 lines
5.0 KiB
Objective-C
//
|
|
// ThemeColor.m
|
|
// xplan-ios
|
|
//
|
|
// Created by 冯硕 on 2021/9/9.
|
|
//
|
|
|
|
#import "ThemeColor.h"
|
|
|
|
@implementation ThemeColor
|
|
/// 主题色0x5FCCE4
|
|
+ (UIColor *)appMainColor {
|
|
return UIColorFromRGB(0x5FCCE4);
|
|
}
|
|
|
|
///强调色 #248CFE
|
|
+ (UIColor *)appEmphasizeColor {
|
|
return UIColorFromRGB(0x248CFE);
|
|
}
|
|
|
|
///强调色1 0xBF36FF
|
|
+ (UIColor *)appEmphasizeColor1 {
|
|
return UIColorFromRGB(0xBF36FF);
|
|
}
|
|
|
|
///强调色2 0xFB486A
|
|
+ (UIColor *)appEmphasizeColor2 {
|
|
return UIColorFromRGB(0xFB486A);
|
|
}
|
|
|
|
/* ------页面相关颜色 START------ */
|
|
/// view的背景色 0xF3F5FA
|
|
+ (UIColor *)appBackgroundColor {
|
|
return UIColorFromRGB(0xF8F8FB);
|
|
}
|
|
/// cell的背景色 0xFFFFFF
|
|
+ (UIColor *)appCellBackgroundColor {
|
|
return UIColorFromRGB(0xFFFFFF);
|
|
}
|
|
///正文颜色 0x333333
|
|
+ (UIColor *)mainTextColor {
|
|
return UIColorFromRGB(0x282828);
|
|
}
|
|
/// 二级文字颜色 0x666666
|
|
+ (UIColor *)secondTextColor {
|
|
return UIColorFromRGB(0x878B9C);
|
|
}
|
|
///三级文字的颜色 0x999999
|
|
+ (UIColor *)textThirdColor {
|
|
return UIColorFromRGB(0xBDBFD0);
|
|
}
|
|
///分割线的颜色 0xE8E8E8
|
|
+ (UIColor *)dividerColor {
|
|
return UIColorFromRGB(0xE8E8E8);
|
|
}
|
|
/* ------页面相关颜色 END------ */
|
|
|
|
/* ------Button 相关颜色 START------ */
|
|
/// button 可用 渐变色的开始 0xFFA936
|
|
+ (UIColor *)confirmButtonGradientStartColor {
|
|
return UIColorFromRGB(0x5BC8F8);
|
|
}
|
|
/// button 可用 渐变色的开始 0xFFCB47
|
|
+ (UIColor *)confirmButtonGradientEndColor {
|
|
return UIColorFromRGB(0x66D9D9);
|
|
}
|
|
/// 确定的按钮文字颜色 #FFFFFF
|
|
+ (UIColor *)confirmButtonTextColor {
|
|
return UIColorFromRGB(0xFFFFFF);
|
|
}
|
|
/// 取消按钮 渐变色的开始 0xF7DDBF
|
|
+ (UIColor *)cancelButtonGradientStartColor {
|
|
return UIColorFromRGB(0xCEEFFD);
|
|
}
|
|
/// 取消按钮 渐变色的结束 0xF7E8C4
|
|
+ (UIColor *)cancelButtonGradientEndColor {
|
|
return UIColorFromRGB(0xD2F4F4);
|
|
}
|
|
/// 取消的按钮文字颜色 0xFFA936
|
|
+ (UIColor *)cancelButtonTextColor {
|
|
return UIColorFromRGB(0x5FCCE4);
|
|
}
|
|
/// 取消按钮单一普通背景色 0xFFCE4E
|
|
+ (UIColor *)cancelButtonNormalBgColor {
|
|
return UIColorFromRGB(0xCEEFFD);
|
|
}
|
|
/// 按钮不可点击背景色 0xD2D5D7
|
|
+ (UIColor *)disableButtonColor {
|
|
return UIColorFromRGB(0xCEEFFD);
|
|
}
|
|
/// 按钮不可点击文字颜色 0xF9F9F9
|
|
+ (UIColor *)disableButtonTextColor {
|
|
return UIColorFromRGB(0x5FCCE4);
|
|
}
|
|
/* ------Button 相关颜色 END------ */
|
|
|
|
/* ------弹窗相关颜色 START------ */
|
|
+ (UIColor *)alertBackgroundColor {
|
|
return UIColorFromRGB(0xFFFFFF);
|
|
}
|
|
+ (UIColor *)alertTitleColor {
|
|
return UIColorFromRGB(0x333333);
|
|
}
|
|
+ (UIColor *)alertMessageColor {
|
|
return UIColorFromRGB(0x333333);
|
|
}
|
|
+ (UIColor *)actionSeparatorColor {
|
|
return UIColorFromRGB(0xF0F0F0);
|
|
}
|
|
/* ------弹窗相关颜色 END------ */
|
|
|
|
///tabbar 没有点击的时候颜色 0x333333, 0.4
|
|
+ (UIColor *)tabbarNormalColor {
|
|
return UIColorRGBAlpha(0x333333, 0.4);
|
|
}
|
|
/// tabbar的View的color 0xFFFFFF
|
|
+ (UIColor *)tabbarViewColor {
|
|
return UIColorFromRGB(0xFFFFFF);
|
|
}
|
|
|
|
+ (UIColor *)colorWithHexString: (NSString *) hexString {
|
|
if (hexString.length == 0) {
|
|
return [UIColor blackColor];
|
|
}
|
|
NSString *colorString = [[hexString stringByReplacingOccurrencesOfString: @"#" withString: @""] uppercaseString];
|
|
CGFloat alpha, red, blue, green;
|
|
switch ([colorString length]) {
|
|
case 3: // #RGB
|
|
alpha = 1.0f;
|
|
red = [self colorComponentFrom: colorString start: 0 length: 1];
|
|
green = [self colorComponentFrom: colorString start: 1 length: 1];
|
|
blue = [self colorComponentFrom: colorString start: 2 length: 1];
|
|
break;
|
|
case 4: // #ARGB
|
|
alpha = [self colorComponentFrom: colorString start: 0 length: 1];
|
|
red = [self colorComponentFrom: colorString start: 1 length: 1];
|
|
green = [self colorComponentFrom: colorString start: 2 length: 1];
|
|
blue = [self colorComponentFrom: colorString start: 3 length: 1];
|
|
break;
|
|
case 6: // #RRGGBB
|
|
alpha = 1.0f;
|
|
red = [self colorComponentFrom: colorString start: 0 length: 2];
|
|
green = [self colorComponentFrom: colorString start: 2 length: 2];
|
|
blue = [self colorComponentFrom: colorString start: 4 length: 2];
|
|
break;
|
|
case 8: // #AARRGGBB
|
|
alpha = [self colorComponentFrom: colorString start: 0 length: 2];
|
|
red = [self colorComponentFrom: colorString start: 2 length: 2];
|
|
green = [self colorComponentFrom: colorString start: 4 length: 2];
|
|
blue = [self colorComponentFrom: colorString start: 6 length: 2];
|
|
break;
|
|
default:
|
|
[NSException raise:@"Invalid color value" format: @"Color value %@ is invalid. It should be a hex value of the form #RBG, #ARGB, #RRGGBB, or #AARRGGBB", hexString];
|
|
break;
|
|
}
|
|
return [UIColor colorWithRed: red green: green blue: blue alpha: alpha];
|
|
}
|
|
|
|
+ (CGFloat) colorComponentFrom: (NSString *) string start: (NSUInteger) start length: (NSUInteger) length {
|
|
NSString *substring = [string substringWithRange: NSMakeRange(start, length)];
|
|
NSString *fullHex = length == 2 ? substring : [NSString stringWithFormat: @"%@%@", substring, substring];
|
|
unsigned hexComponent;
|
|
[[NSScanner scannerWithString: fullHex] scanHexInt: &hexComponent];
|
|
return hexComponent / 255.0;
|
|
}
|
|
|
|
@end
|