diff --git a/Sources/ElegantCalendar/Helpers/Extensions/EnvironmentKey+CalendarTheme.swift b/Sources/ElegantCalendar/Helpers/Extensions/EnvironmentKey+CalendarTheme.swift index 4c460e4..e0e362d 100644 --- a/Sources/ElegantCalendar/Helpers/Extensions/EnvironmentKey+CalendarTheme.swift +++ b/Sources/ElegantCalendar/Helpers/Extensions/EnvironmentKey+CalendarTheme.swift @@ -5,15 +5,18 @@ import SwiftUI public struct CalendarTheme: Equatable, Hashable { public let primary: Color - public let todayColor: Color + public let titleColor: Color + public let textColor: Color + public let todayTextColor: Color + public let todayBackgroundColor: Color - public init(primary: Color, todayColor: Color? = nil) { + public init(primary: Color, titleColor: Color? = nil, textColor: Color? = nil, todayTextColor: Color? = nil, todayBackgroundColor: Color? = nil) { self.primary = primary - if let todayColor = todayColor { - self.todayColor = todayColor - } else { - self.todayColor = primary - } + + if let titleColor = titleColor { self.titleColor = titleColor } else { self.titleColor = primary } + if let textColor = textColor { self.textColor = textColor } else { self.textColor = .primary } + if let todayTextColor = todayTextColor { self.todayTextColor = todayTextColor } else { self.todayTextColor = primary } + if let todayBackgroundColor = todayBackgroundColor { self.todayBackgroundColor = todayBackgroundColor } else { self.todayBackgroundColor = .primary } } } diff --git a/Sources/ElegantCalendar/Views/Monthly/DayView.swift b/Sources/ElegantCalendar/Views/Monthly/DayView.swift index 7ec5622..775588e 100644 --- a/Sources/ElegantCalendar/Views/Monthly/DayView.swift +++ b/Sources/ElegantCalendar/Views/Monthly/DayView.swift @@ -54,16 +54,16 @@ struct DayView: View, MonthlyCalendarManagerDirectAccess { private var foregroundColor: Color { if isDayToday { - return theme.primary + return theme.todayTextColor } else { - return .primary + return theme.textColor } } private var backgroundColor: some View { Group { if isDayToday { - theme.todayColor + theme.todayBackgroundColor } else if isDaySelectableAndInRange { theme.primary .opacity(datasource?.calendar(backgroundColorOpacityForDate: day) ?? 1) diff --git a/Sources/ElegantCalendar/Views/Monthly/MonthView.swift b/Sources/ElegantCalendar/Views/Monthly/MonthView.swift index f4f34a5..c99a63f 100644 --- a/Sources/ElegantCalendar/Views/Monthly/MonthView.swift +++ b/Sources/ElegantCalendar/Views/Monthly/MonthView.swift @@ -59,14 +59,14 @@ private extension MonthView { .font(.system(size: 26)) .bold() .tracking(7) - .foregroundColor(isWithinSameMonthAndYearAsToday ? theme.primary : .primary) + .foregroundColor(isWithinSameMonthAndYearAsToday ? theme.titleColor : .primary) } var yearText: some View { Text(month.year) .font(.system(size: 12)) .tracking(2) - .foregroundColor(isWithinSameMonthAndYearAsToday ? theme.primary : .gray) + .foregroundColor(isWithinSameMonthAndYearAsToday ? theme.titleColor : .gray) .opacity(0.95) }