From 988d719f794ec02b1fc3f267b2359e9304b47102 Mon Sep 17 00:00:00 2001 From: Rajesh Budhiraja Date: Mon, 25 Dec 2023 00:45:47 +0530 Subject: [PATCH 1/2] Add: BG Color Support --- .../Extensions/EnvironmentKey+CalendarTheme.swift | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Sources/ElegantCalendar/Helpers/Extensions/EnvironmentKey+CalendarTheme.swift b/Sources/ElegantCalendar/Helpers/Extensions/EnvironmentKey+CalendarTheme.swift index e0e362d..8507b3a 100644 --- a/Sources/ElegantCalendar/Helpers/Extensions/EnvironmentKey+CalendarTheme.swift +++ b/Sources/ElegantCalendar/Helpers/Extensions/EnvironmentKey+CalendarTheme.swift @@ -9,14 +9,21 @@ public struct CalendarTheme: Equatable, Hashable { public let textColor: Color public let todayTextColor: Color public let todayBackgroundColor: Color - - public init(primary: Color, titleColor: Color? = nil, textColor: Color? = nil, todayTextColor: Color? = nil, todayBackgroundColor: Color? = nil) { + public let backgroundColor: Color + + public init(primary: Color, + titleColor: Color? = nil, + textColor: Color? = nil, + todayTextColor: Color? = nil, + todayBackgroundColor: Color? = nil, + backgroundColor: Color = .black) { self.primary = 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 } + self.backgroundColor = backgroundColor } } From b461a7f90b78f3afab2d35bf040d002456bc6c20 Mon Sep 17 00:00:00 2001 From: Rajesh Budhiraja Date: Mon, 25 Dec 2023 00:50:33 +0530 Subject: [PATCH 2/2] Use: BGColor in YearView --- Sources/ElegantCalendar/Views/Yearly/YearView.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Sources/ElegantCalendar/Views/Yearly/YearView.swift b/Sources/ElegantCalendar/Views/Yearly/YearView.swift index 4654e8e..9f9f1ef 100644 --- a/Sources/ElegantCalendar/Views/Yearly/YearView.swift +++ b/Sources/ElegantCalendar/Views/Yearly/YearView.swift @@ -15,10 +15,13 @@ struct YearView: View, YearlyCalendarManagerDirectAccess { } var body: some View { - VStack(alignment: .leading, spacing: 40) { - yearText - monthsStack - Spacer() + ZStack { + theme.backgroundColor + VStack(alignment: .leading, spacing: 40) { + yearText + monthsStack + Spacer() + } } .padding(.top, CalendarConstants.Yearly.topPadding) .frame(width: CalendarConstants.Yearly.cellWidth, height: CalendarConstants.cellHeight)