本文へスキップ

ColorPicker

CSS 形式の RGBA 文字列を返す、ネイティブ SwiftUI カラーピッカーです。

#インポート

github.com/egoist/quickgui/go/ui から ui をインポートします。

import (
	"github.com/egoist/quickgui/go/native"
	"github.com/egoist/quickgui/go/ui"
)

#使い方

func SwiftUiColorPickerExample() *native.Node {
	value, setValue := ui.CreateSignal("#2563ebff")
	return ui.SwiftUI.Host(
		ui.SwiftUIHostProps{MatchContents: true},
		func() *native.Node {
			return ui.SwiftUI.ColorPicker(ui.SwiftUIColorPickerProps{
				Selection:         value,
				Label:             "Accent",
				SupportsOpacity:   true,
				OnSelectionChange: func(next string, _ *native.Event) { setValue(next) },
			})
		},
	)
}

#API リファレンス

項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。

SwiftUI.ColorPicker

ソースを見る
ui.SwiftUI.ColorPicker(props SwiftUIColorPickerProps) *native.Node
TestIDany—

Stable identifier for native automation and tests.

any
ソースを見る
Modifiersany—

Ordered SwiftUI view modifiers applied to the hosted control.

any
ソースを見る
Reffunc(*native.Node)—

Receives the retained native node after construction. Keep imperative work in event or lifecycle callbacks.

func(*native.Node)
ソースを見る
Selectionany—

Controlled selection for a table, native picker, or color control.

any
ソースを見る
Labelany—

Visible native SwiftUI control label.

any
ソースを見る
SupportsOpacityany—

Allows alpha selection in the native color panel.

any
ソースを見る
OnSelectionChangefunc(string, *native.Event)—

Reports the selected native picker option or color.

func(string, *native.Event)
ソースを見る