1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

SwiftUI RGBで色を指定する方法

Posted at

RGBで色を指定する方法

Color(red: 0.3, green: 0.5, blue: 0.2)

で指定することができます。
0~1の数字を使う必要があります。
そのため、よく0~255の数字で表現されていることが多いと思いますが、そういう時は数字/255で指定することもできます!

透明度も指定したい時は、opacityを足せば使えます。

Color(red: 0.3, green: 0.5, blue: 0.2,opacity:0.4)

これで透明度も指定できます。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?