Fun: Make each tab have its own color theme

This commit is contained in:
James Magahern
2021-02-11 17:54:22 -08:00
parent f32c90f2e3
commit 8a39176414
3 changed files with 26 additions and 0 deletions

View File

@@ -40,6 +40,25 @@ class Tab: NSObject, SBRProcessBundleBridgeDelegate
didSet { bridge.allowAllScripts = javaScriptEnabled }
}
public lazy var colorTheme: [UIColor] = {
// Looks really cool as-is, but maybe compute a color based on the
// title or URL to make it show up the same for each website?
return [
UIColor(
hue: CGFloat.random(in: 0...1.0),
saturation: 0.89,
brightness: 0.3,
alpha: 1.0
),
UIColor(
hue: CGFloat.random(in: 0...1.0),
saturation: 1.0,
brightness: 0.7,
alpha: 1.0
),
]
}()
public var identifier = UUID()
public var favicon: UIImage?