Swift/Swift UI
[Drawing and Graphics] Color
내일은개발천재🎵
2022. 4. 3. 17:25
Color
어떤 컴포넌트인가?
- A representation of a color that adapts to a given context.
- 컨텐츠에 색을 입힌다.
어떻게 사용하는가?
// 정의
@frozen struct Color
// 색 만들기
// 방법1. Asset Catalog
let aqua = Color("aqua")
// 방법2. RGB 값, 색조, 포화 및 밝기 사용
let skyBlue = Color(red: 0.4627, green: 0.8392, blue: 1.0)
let lemonYellow = Color(hue: 0.1639, saturation: 1, brightness: 1)
let steelGray = Color(white: 0.4745)
// 방법3. 인스턴스마다 다른 색상 선택
#if os(iOS)
let linkColor = Color(uiColor: .link)
#elseif os(macOS)
let linkColor = Color(nsColor: .linkColor)
#endif
왜 사용하는가?
- Color is a great way to impart vitality, provide visual continuity, communicate status information, give feedback in response to user actions, and help people visualize data
- 단순 심미적인 요소일 뿐만 아니라, 사용자의 행위에 따른 피드백을 줄 수 있다. 또한 데이터를 시각화하는데에 좋기 때문이다.
Document Link
Color - Visual Design - iOS - Human Interface Guidelines - Apple Developer
Color Color is a great way to impart vitality, provide visual continuity, communicate status information, give feedback in response to user actions, and help people visualize data. Look to the system’s color scheme for guidance when picking app accent co
developer.apple.com
Apple Developer Documentation
developer.apple.com