FWColorClassWrapper

@interface FWColorClassWrapper : FWClassWrapper

Undocumented

FWTheme

  • 动态创建主题色,分别指定浅色和深色

    Declaration

    Objective-C

    - (nonnull UIColor *)themeLight:(nonnull UIColor *)light
                               dark:(nonnull UIColor *)dark;
  • 动态创建主题色,指定提供句柄

    Declaration

    Objective-C

    - (nonnull UIColor *)themeColor:
        (nonnull UIColor *_Nonnull (^)(FWThemeStyle))provider;
  • 动态创建主题色,指定名称,兼容iOS11+系统方式(仅iOS13+支持动态颜色)和手工指定。失败时返回clear防止崩溃

    Declaration

    Objective-C

    - (nonnull UIColor *)themeNamed:(nonnull NSString *)name;
  • 动态创建主题色,指定名称和bundle,兼容iOS11+系统方式(仅iOS13+支持动态颜色)和手工指定。失败时返回clear防止崩溃

    Declaration

    Objective-C

    - (nonnull UIColor *)themeNamed:(nonnull NSString *)name
                             bundle:(nullable NSBundle *)bundle;
  • 手工单个注册主题色,未配置主题色或者需兼容iOS11以下时可使用本方式

    Declaration

    Objective-C

    - (void)setThemeColor:(nullable UIColor *)color
                  forName:(nonnull NSString *)name;
  • 手工批量注册主题色,未配置主题色或者需兼容iOS11以下时可使用本方式

    Declaration

    Objective-C

    - (void)setThemeColors:
        (nonnull NSDictionary<NSString *, UIColor *> *)nameColors;

FWToolkit

  • 设置十六进制颜色标准为ARGB|RGBA,启用为ARGB,默认为RGBA

    Declaration

    Objective-C

    @property (nonatomic) BOOL colorStandardARGB;
  • 获取透明度为1.0的RGB随机颜色

    Declaration

    Objective-C

    @property (nonatomic, readonly) UIColor *_Nonnull randomColor;
  • 从十六进制值初始化,格式:0x20B2AA,透明度为1.0

    Declaration

    Objective-C

    - (nonnull UIColor *)colorWithHex:(long)hex;
  • 从十六进制值初始化,格式:0x20B2AA,自定义透明度

    Declaration

    Objective-C

    - (nonnull UIColor *)colorWithHex:(long)hex alpha:(CGFloat)alpha;
  • 从十六进制字符串初始化,支持RGB、RGBA|ARGB,格式:@“20B2AA”, @“#FFFFFF",透明度为1.0,失败时返回clear

    Declaration

    Objective-C

    - (nonnull UIColor *)colorWithHexString:(nonnull NSString *)hexString;
  • 从十六进制字符串初始化,支持RGB、RGBA|ARGB,格式:@“20B2AA”, @“#FFFFFF",自定义透明度,失败时返回clear

    Declaration

    Objective-C

    - (nonnull UIColor *)colorWithHexString:(nonnull NSString *)hexString
                                      alpha:(CGFloat)alpha;
  • 从颜色字符串初始化,支持十六进制和颜色值,透明度为1.0,失败时返回clear

    Declaration

    Objective-C

    - (nonnull UIColor *)colorWithString:(nonnull NSString *)string;
  • 从颜色字符串初始化,支持十六进制和颜色值,自定义透明度,失败时返回clear

    Declaration

    Objective-C

    - (nonnull UIColor *)colorWithString:(nonnull NSString *)string
                                   alpha:(CGFloat)alpha;