Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
fix calendar colors
Browse files Browse the repository at this point in the history
  • Loading branch information
tgymnich committed Jan 11, 2021
1 parent 835867a commit b6f3013
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions TUM Campus App/Calendar/CalendarEventViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,20 @@ final class CalendarEventViewModel: EventDescriptor {
}
}
var backgroundColor = UIColor.systemBlue.withAlphaComponent(0.2)
var textColor = UIColor.label
var textColor = UIColor { traitCollection in
switch traitCollection.userInterfaceStyle {
case .dark: return UIColor(red: 28/255, green: 171/255, blue: 246/255, alpha: 1)
default: return UIColor(red: 34/255, green: 126/255, blue: 177/255, alpha: 1)
}

}
var secondaryTextColor = UIColor { traitCollection in
switch traitCollection.userInterfaceStyle {
case .dark: return UIColor(red: 28/255, green: 171/255, blue: 246/255, alpha: 1)
default: return UIColor(red: 34/255, green: 126/255, blue: 177/255, alpha: 1)
}

}
var font = UIFont.boldSystemFont(ofSize: 12)
var userInfo: Any?
var lineBreakMode: NSLineBreakMode? = .byWordWrapping
Expand All @@ -44,14 +57,14 @@ final class CalendarEventViewModel: EventDescriptor {
self.startDate = startDate
self.endDate = endDate
self.text = title
let attributedTitle = NSMutableAttributedString(string: title).font(.systemFont(ofSize: 12, weight: .semibold)).color(.label)
let attributedTitle = NSMutableAttributedString(string: title).font(.systemFont(ofSize: 12, weight: .bold)).color(textColor)
if let location = event.location {
let attributedLocation = NSMutableAttributedString(string: location).font(.systemFont(ofSize: 12, weight: .light)).color(.label)
let attributedLocation = NSMutableAttributedString(string: location).font(.systemFont(ofSize: 12, weight: .regular)).color(textColor)
attributedTitle.append(NSAttributedString(string: "\n"))
attributedTitle.append(attributedLocation)
}
if let description = event.descriptionText {
let attributedLocation = NSMutableAttributedString(string: description).font(.systemFont(ofSize: 12, weight: .light)).color(.secondaryLabel)
let attributedLocation = NSMutableAttributedString(string: description).font(.systemFont(ofSize: 12, weight: .regular)).color(secondaryTextColor)
attributedTitle.append(NSAttributedString(string: "\n\n"))
attributedTitle.append(attributedLocation)
}
Expand Down

0 comments on commit b6f3013

Please sign in to comment.