SwiftUI/Drawing and graphics/Color

色の指定。 .ignoreSafeArea() をつけないとノッチの横とかが色が塗れない。

Color
TypeStructure
iOS13.0+
iPadOS13.0+
macOS10.15+
MacCatalyst13.0+
tvOS13.0+
watchOS6.0+
Websitedeveloper.apple.com/documentation/swiftui/color/

HSV指定、RGB指定、規定色が使用可能。

規定色

規定色一覧
指定
.black 色違いの文字
.blue 色違いの文字
.brown 色違いの文字
.cyan 色違いの文字
.gray 色違いの文字
.green 色違いの文字
.indigo 色違いの文字
.mint 色違いの文字
.orange 色違いの文字
.pink 色違いの文字
.purple 色違いの文字
.red 色違いの文字
.teal 色違いの文字
.white 色違いの文字
.yellow 色違いの文字

.primary, .secondary, .accentColor の指定も出来るが、ダークモードの設定等で、色が変わる。

透明度

.clear
透明な色になる。
.ignoreSafeArea
ノッチの周辺部分まで塗りつぶす
.opacity
透過度を0~1.0 の間で指定する。0 にすると.clear と同じ。

External Link

【SwiftUI】色の指定方法(Color)