everything changed
This commit is contained in:
@@ -14,6 +14,8 @@ struct ThemeConstants {
|
||||
enum Theme: Int, CaseIterable {
|
||||
case system
|
||||
case iFeel
|
||||
case dark
|
||||
case light
|
||||
|
||||
var title: String {
|
||||
switch self {
|
||||
@@ -21,6 +23,10 @@ enum Theme: Int, CaseIterable {
|
||||
return SystemTheme.title
|
||||
case .iFeel:
|
||||
return IFeelTheme.title
|
||||
case .dark:
|
||||
return AlwaysDark.title
|
||||
case .light:
|
||||
return AlwaysLight.title
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,24 +37,33 @@ enum Theme: Int, CaseIterable {
|
||||
return SystemTheme()
|
||||
case .iFeel:
|
||||
return IFeelTheme()
|
||||
case .dark:
|
||||
return AlwaysDark()
|
||||
case .light:
|
||||
return AlwaysLight()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protocol Themeable {
|
||||
static var title: String { get }
|
||||
var secondaryBGColor: UIColor { get }
|
||||
var secondaryBGColor: Color { get }
|
||||
var bg: AnyView { get }
|
||||
var preview: AnyView { get }
|
||||
var labelColor: Color { get }
|
||||
}
|
||||
|
||||
struct IFeelTheme: Themeable {
|
||||
static var title: String {
|
||||
return "iFeel Theme"
|
||||
var labelColor: Color {
|
||||
return Color(uiColor: UIColor.label)
|
||||
}
|
||||
|
||||
var secondaryBGColor: UIColor {
|
||||
return UIColor.systemBackground
|
||||
static var title: String {
|
||||
return "iFeel"
|
||||
}
|
||||
|
||||
var secondaryBGColor: Color {
|
||||
return Color(uiColor: UIColor.systemBackground)
|
||||
}
|
||||
|
||||
var bg: AnyView {
|
||||
@@ -69,12 +84,16 @@ struct IFeelTheme: Themeable {
|
||||
}
|
||||
|
||||
struct SystemTheme: Themeable {
|
||||
var labelColor: Color {
|
||||
return Color(uiColor: UIColor.label)
|
||||
}
|
||||
|
||||
static var title: String {
|
||||
return "System"
|
||||
}
|
||||
|
||||
var secondaryBGColor: UIColor {
|
||||
return UIColor.secondarySystemBackground
|
||||
var secondaryBGColor: Color {
|
||||
return Color(uiColor: UIColor.secondarySystemBackground)
|
||||
}
|
||||
|
||||
var bg: AnyView {
|
||||
@@ -97,3 +116,71 @@ struct SystemTheme: Themeable {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
struct AlwaysDark: Themeable {
|
||||
var labelColor: Color {
|
||||
return .white
|
||||
}
|
||||
|
||||
static var title: String {
|
||||
return "Dark"
|
||||
}
|
||||
|
||||
var secondaryBGColor: Color {
|
||||
return Color(uiColor: UIColor.secondarySystemBackground.resolvedColor(with: .init(userInterfaceStyle: .dark)))
|
||||
}
|
||||
|
||||
var bg: AnyView {
|
||||
return AnyView(
|
||||
ZStack {
|
||||
Rectangle()
|
||||
.fill(Color(UIColor.systemBackground.resolvedColor(with: .init(userInterfaceStyle: .dark))))
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
var preview: AnyView {
|
||||
return AnyView(
|
||||
ZStack {
|
||||
Rectangle()
|
||||
.fill(Color(UIColor.secondarySystemBackground.resolvedColor(with: .init(userInterfaceStyle: .dark))))
|
||||
.frame(width: ThemeConstants.iconSize, height: ThemeConstants.iconSize)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 25, style: .continuous))
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
struct AlwaysLight: Themeable {
|
||||
var labelColor: Color {
|
||||
return .black
|
||||
}
|
||||
|
||||
static var title: String {
|
||||
return "Light"
|
||||
}
|
||||
|
||||
var secondaryBGColor: Color {
|
||||
return Color(uiColor: UIColor.secondarySystemBackground.resolvedColor(with: .init(userInterfaceStyle: .light)))
|
||||
}
|
||||
|
||||
var bg: AnyView {
|
||||
return AnyView(
|
||||
ZStack {
|
||||
Rectangle()
|
||||
.fill(Color(UIColor.systemBackground.resolvedColor(with: .init(userInterfaceStyle: .light))))
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
var preview: AnyView {
|
||||
return AnyView(
|
||||
ZStack {
|
||||
Rectangle()
|
||||
.fill(Color(UIColor.secondarySystemBackground.resolvedColor(with: .init(userInterfaceStyle: .light))))
|
||||
.frame(width: ThemeConstants.iconSize, height: ThemeConstants.iconSize)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 25, style: .continuous))
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user