

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSInteger, GradientColorDirection) {
    GradientColorDirectionLevel,//水平渐变
    GradientColorDirectionVertical,//竖直渐变
    GradientColorDirectionDownDiagonalLine,//向上对角线渐变
    GradientColorDirectionUpwardDiagonalLine,//向下对角线渐变
};

NS_ASSUME_NONNULL_BEGIN

@interface UIColor (YMAdditions)

/**
 *  @brief 将16进制色值转成RGB值
 *
 *  @param hexColor 16进制色值
 *
 *  @return UIColor
 */
+(UIColor *)colorWithHex:(long)hexColor;

/**
 *  @brief 将16进制色值转成RGB值
 *
 *  @param hexColor 16进制色值
 *  @param alpha 透明度 0～1之间的浮点数
 *
 *  @return UIColor
 */
+(UIColor *)colorWithHex:(long)hexColor alpha:(float)alpha ;

/**
 *  @brief  获取随机颜色
 *
 *  @return 随机颜色
 */
+(UIColor *)randomColor;

/**
 *  @brief  字符串转化为颜色
 *
 *  @param string 字符串
 *
 *  @return 颜色
 */
+(UIColor *)colorFormString:(NSString *)string;

+ (UIColor *)colorFromHexString:(NSString *)title alpha:(CGFloat)alpha;

/// 设置渐变色
/// @param size 需要渐变的大小
/// @param direction 渐变的方向
/// @param startcolor 渐变的开始颜色
/// @param endColor 渐变的结束颜色
+ (instancetype)gradientColorWithSize:(CGSize)size
                            direction:(GradientColorDirection)direction
                           startColor:(UIColor *)startcolor
                             endColor:(UIColor *)endColor;
@end

NS_ASSUME_NONNULL_END
