Merge pull request #40 from puelocesar/master
Fixes a crash when UIColor returns a color component with negative value
This commit is contained in:
commit
2b9460a023
|
@ -110,6 +110,7 @@ public extension DynamicColor {
|
|||
*/
|
||||
public final func toHex() -> UInt32 {
|
||||
func roundToHex(_ x: CGFloat) -> UInt32 {
|
||||
guard x > 0 else { return 0 }
|
||||
let rounded: CGFloat = round(x * 255)
|
||||
|
||||
return UInt32(rounded)
|
||||
|
|
Loading…
Reference in New Issue