Skip to content

Instantly share code, notes, and snippets.

@thanhluu
Created May 9, 2016 13:42
Show Gist options
  • Save thanhluu/6cfd1437e2661716629af83828d2b998 to your computer and use it in GitHub Desktop.
Save thanhluu/6cfd1437e2661716629af83828d2b998 to your computer and use it in GitHub Desktop.
IntSwiftS1V4T2
//: Playground - noun: a place where people can play
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 .Evening, .Day: 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.0, green: 1.0, blue: 1.0, alpha: 1.0)
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: 68/255.0, green: 133/255.0, blue: 164/255.0, alpha: 1.0)
case .Night: return UIColor(red: 129/255.0, green: 161/255.0, blue: 166/255.0, alpha: 1.0)
}
}
}
let titleLabel = UILabel()
func readingViewWithMode(readingMode: ReadingMode) {
titleLabel.textColor = readingMode.headlineColor
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment