Type Property
型プロパティ
palette
A mode that renders symbols as multiple layers, with different styles applied to the layers.
Discussion
議論
In this mode SwiftUI maps each successively defined layer in the image to the next of the primary, secondary, and tertiary variants of the foreground style. You can specify these styles explicitly using the foregroundStyle(_:_:)
and foregroundStyle(_:_:_:)
modifiers. If you only specify a primary foreground style, SwiftUI automatically derives the others from that style. For example, you can render a filled exclamation mark triangle with yellow as the tint color for the exclamation mark, and fill the triangle with cyan:
Image(systemName: "exclamationmark.triangle.fill")
.symbolRenderingMode(.palette)
.foregroundStyle(Color.yellow, Color.cyan)
You can also omit the symbol rendering mode, as specifying multiple foreground styles implies switching to palette rendering mode:
Image(systemName: "exclamationmark.triangle.fill")
.foregroundStyle(Color.yellow, Color.cyan)
See Also
参照
Getting Symbol Rendering Modes