UIColor
Method Overview
| Name | Description | Return |
|---|
| init() | การ Initial UIColor ด้วยค่าสีที่เป็น Integer | void |
| hex() | การ Initial UIColor ด้วยค่าสีที่เป็น Hex | UIColor |
| toHex() | แปลง UIColor ให้เป็น String ที่อยู่ในรูปของ Hex | Optional(String) |
Method Details
convenience init(red: Int, green: Int, blue: Int, alpha: CGFloat = 1.0)
การ Initial UIColor ด้วยค่าสีที่เป็น Integer
Parameters
| Name | Description | Type |
|---|
| red | ค่าของสีแดงตั้งแต่ 0 – 255 | Int |
| green | ค่าของสีเขียวตั้งแต่ 0 – 255 | Int |
| blue | ค่าของสีน้ำเงินตั้งแต่ 0 – 255 | Int |
| alpha | ค่าความโปร่งแสงของสี | CGFloat |
class func hex(_ hex: String) -> UIColor
การ Initial UIColor ด้วยค่าสีที่เป็น Hex
Parameters
| Name | Description | Type |
|---|
| hex | ค่าของสีที่อยู่ในรูป Hex | String |
Returns
| Type | Description |
|---|
| UIColor | Return UIColor ตามค่าของ Hex |
func toHex(alpha: Bool = false) -> String?
แปลง UIColor ให้เป็น String ที่อยู่ในรูปของ Hex
Parameters
| Name | Description | Type |
|---|
| alpha | การกำหนดค่าของ Hex ว่าต้องการค่า Alpha ด้วยหรือไม่ | Boolean |
Returns
| Type | Description |
|---|
| Optional(String) | Return String ที่อยู่ในรูปของ Hex |