티스토리 뷰

SwiftUI의 Form의 배경색상을 얻는 방법은 다음 사이트에서 잘 설명해주고 있다.

https://sarunw.com/posts/dark-color-cheat-sheet/

 

Dark color cheat sheet | Sarunw

A cheat sheet that tells you what colors to use to support dark mode. This is a guide for those who want to adopt dark mode, but too lazy to figure out which color to use.

sarunw.com

 

나는 Form의 배경색상을 얻는 방법을 원했다.

 

일반 배경은 .systemBackground라는 하나의 색상이 사용된다.

하지만 Form은 그룹 색상이 있기 때문에 두 개의 색상이 사용된다.

.systemGroupedBackground가 배경 색상이 되고, .secondarySystemGroupedBackground가 그룹의 배경 색상이 된다.

 

 

SwiftUI에서는 UIColor 대신 Color를 사용하므로 Color(uiColor:)를 이용해서 다음과 같이 사용할 수 있다.

Color(uiColor: .systemGroupedBackground)

 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2024/09   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
글 보관함