Color Set
Color values corresponding to dark and light appearances
Definition
public struct ColorSet {
public let darkAppearance: Color
public let lightAppearance: Color
public init(
anyAppearance: Color
) {
self.darkAppearance = anyAppearance
self.lightAppearance = anyAppearance
}
public init(
darkAppearance: Color,
lightAppearance: Color
) {
self.darkAppearance = darkAppearance
self.lightAppearance = lightAppearance
}
public init(
anyAppearance: UIColor
) {
self.darkAppearance = Color(uiColor: anyAppearance)
self.lightAppearance = Color(uiColor: anyAppearance)
}
public init(
darkAppearance: UIColor,
lightAppearance: UIColor
) {
self.darkAppearance = Color(uiColor: darkAppearance)
self.lightAppearance = Color(uiColor: lightAppearance)
}
}Properties
| Property | Type | Description |
|---|---|---|
| darkAppearance | Color | The value for ColorScheme.dark |
| lightAppearance | Color | The value for ColorScheme.light |
Sample Usages
private let background: ColorSet = .init(
anyAppearance: .init(
red: Double(0xF3) / 255.0,
green: Double(0xF4) / 255.0,
blue: Double(0xF6) / 255.0
)
)private let background: ColorSet = .init(
darkAppearance: .init(
red: Double(0x11) / 255.0,
green: Double(0x11) / 255.0,
blue: Double(0x11) / 255.0
),
lightAppearance: .init(
red: Double(0xF3) / 255.0,
green: Double(0xF4) / 255.0,
blue: Double(0xF6) / 255.0
)
)private let background: ColorSet = .init(
anyAppearance: .init(
red: 0xF3 / 255.0,
green: 0xF4 / 255.0,
blue: 0xF6 / 255.0,
alpha: 1.0
)
)private let background: ColorSet = .init(
darkAppearance: .init(
red: 0x11 / 255.0,
green: 0x11 / 255.0,
blue: 0x11 / 255.0,
alpha: 1.0
),
lightAppearance: .init(
red: 0xF3 / 255.0,
green: 0xF4 / 255.0,
blue: 0xF6 / 255.0,
alpha: 1.0
)
)Updated 5 months ago
