Skip to content
This repository was archived by the owner on Jun 13, 2021. It is now read-only.
This repository was archived by the owner on Jun 13, 2021. It is now read-only.

Gradient starts giving rare hex values #254

@franmontaldo

Description

@franmontaldo

When i run this code:

for x in 1...10 {
            print("\(CGFloat(x) / CGFloat(10) * 100)%")
            print("final color: \(UIColor(hexString: "#95A4A5")!.darken(byPercentage: CGFloat(x) / CGFloat(10))!.hexValue())")
}

i get this output:

10.0%
final color: #7D8A8B
20.0%
final color: #667172
30.0%
final color: #4F5758
40.0%
final color: #383E3F
50.0%
final color: #212525
60.0%
final color: #0A0B0C
70.0%
final color: #FFFFFFF4FFFFFFF3FFFFFFF3
80.0%
final color: #FFFFFFDDFFFFFFDAFFFFFFDA
90.0%
final color: #FFFFFFC6FFFFFFC0FFFFFFC0
100.0%
final color: #FFFFFFAFFFFFFFA7FFFFFFA7

shouldnt the %100 percentage be equal or less than #FFFFFF?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions