UIColor(FWToolkit)

@interface UIColor (FWToolkit)

/// 获取当前颜色指定透明度的新颜色
- (UIColor *)fw_colorWithAlpha:(CGFloat)alpha NS_REFINED_FOR_SWIFT;

/// 读取颜色的十六进制值RGB,不含透明度
@property (nonatomic, assign, readonly) long fw_hexValue NS_REFINED_FOR_SWIFT;

/// 读取颜色的透明度值,范围0~1
@property (nonatomic, assign, readonly) CGFloat fw_alphaValue NS_REFINED_FOR_SWIFT;

/// 读取颜色的十六进制字符串RGB,不含透明度
@property (nonatomic, copy, readonly) NSString *fw_hexString NS_REFINED_FOR_SWIFT;

/// 读取颜色的十六进制字符串RGBA|ARGB(透明度为1时RGB),包含透明度
@property (nonatomic, copy, readonly) NSString *fw_hexAlphaString NS_REFINED_FOR_SWIFT;

/// 设置十六进制颜色标准为ARGB|RGBA,启用为ARGB,默认为RGBA
@property (class, nonatomic, assign) BOOL fw_colorStandardARGB NS_REFINED_FOR_SWIFT;

/// 获取透明度为1.0的RGB随机颜色
@property (class, nonatomic, readonly) UIColor *fw_randomColor NS_REFINED_FOR_SWIFT;

/// 从十六进制值初始化,格式:0x20B2AA,透明度为1.0
+ (UIColor *)fw_colorWithHex:(long)hex NS_REFINED_FOR_SWIFT;

/// 从十六进制值初始化,格式:0x20B2AA,自定义透明度
+ (UIColor *)fw_colorWithHex:(long)hex alpha:(CGFloat)alpha NS_REFINED_FOR_SWIFT;

/// 从十六进制字符串初始化,支持RGB、RGBA|ARGB,格式:@"20B2AA", @"#FFFFFF",透明度为1.0,失败时返回clear
+ (UIColor *)fw_colorWithHexString:(NSString *)hexString NS_REFINED_FOR_SWIFT;

/// 从十六进制字符串初始化,支持RGB、RGBA|ARGB,格式:@"20B2AA", @"#FFFFFF",自定义透明度,失败时返回clear
+ (UIColor *)fw_colorWithHexString:(NSString *)hexString alpha:(CGFloat)alpha NS_REFINED_FOR_SWIFT;

@end

Undocumented

  • 获取当前颜色指定透明度的新颜色

    Declaration

    Objective-C

    - (nonnull UIColor *)fw_colorWithAlpha:(CGFloat)alpha;
  • 读取颜色的十六进制值RGB,不含透明度

    Declaration

    Objective-C

    @property (nonatomic, readonly) long fw_hexValue;
  • 读取颜色的透明度值,范围0~1

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGFloat fw_alphaValue;
  • 读取颜色的十六进制字符串RGB,不含透明度

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NS_REFINED_FOR_SWIFT NSString *fw_hexString;
  • 读取颜色的十六进制字符串RGBA|ARGB(透明度为1时RGB),包含透明度

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NS_REFINED_FOR_SWIFT NSString *fw_hexAlphaString;
  • 设置十六进制颜色标准为ARGB|RGBA,启用为ARGB,默认为RGBA

    Declaration

    Objective-C

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

    Declaration

    Objective-C

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

    Declaration

    Objective-C

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

    Declaration

    Objective-C

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

    Declaration

    Objective-C

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

    Declaration

    Objective-C

    + (nonnull UIColor *)fw_colorWithHexString:(nonnull NSString *)hexString
                                         alpha:(CGFloat)alpha;