Skip to content

Instantly share code, notes, and snippets.

@Pasanpr
Created December 16, 2016 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pasanpr/3f4e59ffabefc1a6e9f5aee1115942eb to your computer and use it in GitHub Desktop.
Save Pasanpr/3f4e59ffabefc1a6e9f5aee1115942eb to your computer and use it in GitHub Desktop.
Code snippet for ReadingMode enum
import UIKit
enum ReadingMode {
case day
case evening
case night
var statusBarStyle: UIStatusBarStyle {
switch self {
case .day, .evening: return .default
case .night: return .lightContent
}
}
var headlineColor: UIColor {
switch self {
case .night: return UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
case .day, .evening: return UIColor(red: 16/255.0, green: 16/255.0, blue: 16/255.0, alpha: 1.0)
}
}
var dateColor: UIColor {
switch self {
case .day, .evening: return UIColor(red: 132/255.0, green: 132/255.0, blue: 132/255.0, alpha: 1.0)
case .night: return UIColor(red: 151/255.0, green: 151/255.0, blue: 151/255.0, alpha: 1.0)
}
}
var bodyTextColor: UIColor {
switch self {
case .day, .evening: return UIColor(red: 1, green: 1, blue: 1, alpha: 1)
case .night: return UIColor(red: 151/255.0, green: 151/255.0, blue: 151/255.0, alpha: 1.0)
}
}
var linkColor: UIColor {
switch self {
case .day, .evening: return UIColor(red: 132/255.0, green: 132/255.0, blue: 132/255.0, alpha: 1.0)
case .night: return UIColor(red: 161/255.0, green: 161/255.0, blue: 161/255.0, alpha: 1.0)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment