Skip to content

Commit 2f0477f

Browse files
committed
Add the tint modifier
1 parent 88094fe commit 2f0477f

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

AndroidSwiftUICore/Sources/AndroidSwiftUICore/Modifiers/AppearanceModifiers.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,20 @@ public extension View {
8080
modifier(_ClipShapeModifier(kind: shape._shapeKind, cornerRadius: shape._cornerRadius))
8181
}
8282
}
83+
84+
// MARK: - Tint
85+
86+
/// Sets the accent color for controls in the subtree (an environment value,
87+
/// like `.foregroundColor`).
88+
public struct _TintModifier: RenderModifier {
89+
let color: Color
90+
public var _modifierNode: ModifierNode {
91+
ModifierNode(kind: "tint", args: ["color": color.propValue])
92+
}
93+
}
94+
95+
public extension View {
96+
func tint(_ color: Color) -> ModifiedContent<Self, _TintModifier> {
97+
modifier(_TintModifier(color: color))
98+
}
99+
}

0 commit comments

Comments
 (0)