diff --git a/Sources/JKCalendar.swift b/Sources/JKCalendar.swift index 5b47e9a..764c3ba 100644 --- a/Sources/JKCalendar.swift +++ b/Sources/JKCalendar.swift @@ -68,6 +68,17 @@ public class JKCalendar: UIView { } } + public var shouldApplyPastDayColor = false + + /** + The color of the past day text. Default value for this property is a black color. Only Used if shouldApplyPastDayColor is true + */ + public var pastDayColor: UIColor = UIColor.black { + didSet { + reloadData() + } + } + /** A Boolean value that determines whether scrolling is enabled. The default is true. */ diff --git a/Sources/JKCalendarView.swift b/Sources/JKCalendarView.swift index 8fe1e2b..9ba09d3 100644 --- a/Sources/JKCalendarView.swift +++ b/Sources/JKCalendarView.swift @@ -517,6 +517,8 @@ class JKCalendarView: UIView{ return info.day >= mark.start && info.day <= mark.end }) { unitStrAttrs[NSAttributedString.Key.foregroundColor] = calendar.backgroundColor + } else if info.day.date < Date() && calendar.shouldApplyPastDayColor { + unitStrAttrs[NSAttributedString.Key.foregroundColor] = calendar.pastDayColor } else if info.day == month{ unitStrAttrs[NSAttributedString.Key.foregroundColor] = calendar.textColor } else {