-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
A gradients stops can have a percentage to specify where the color starts.
For example, these are the same:
linear-gradient(red, orange, yellow, green, blue);
linear-gradient(red 0%, orange 25%, yellow 50%, green 75%, blue 100%);Currently the gradient cases on Color only receive [Color] as stops.
I think there should be a Color case that looks something like:
case linearGradient(_ direction: LinearGradient.Direction, _ stops: [(Color, Int)])or:
case linearGradient(_ direction: LinearGradient.Direction, _ stops: [ColorStop])
// ...
public struct ColorStop: CustomStringConvertible {
let color: Color
let positions: [Int]
public var description: String {
color.description + positions.map { String($0) + "%" } .joined(separator: " ")
}
public static func color(_ color: Color, at percentages: Int...) -> ColorStop {
return ColorStop(color: color, positions: percentages)
}
}Metadata
Metadata
Assignees
Labels
No labels