mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
26 lines
1.5 KiB
Swift
26 lines
1.5 KiB
Swift
import Foundation
|
|
import UIKit
|
|
import TelegramUIPreferences
|
|
|
|
public func makePresentationTheme(themeReference: PresentationThemeReference, accentColor: UIColor?, serviceBackgroundColor: UIColor, baseColor: PresentationThemeBaseColor?, preview: Bool = false) -> PresentationTheme {
|
|
let theme: PresentationTheme
|
|
switch themeReference {
|
|
case let .builtin(reference):
|
|
switch reference {
|
|
case .dayClassic:
|
|
theme = makeDefaultDayPresentationTheme(serviceBackgroundColor: serviceBackgroundColor, baseColor: baseColor, day: false, preview: preview)
|
|
case .night:
|
|
theme = makeDarkPresentationTheme(accentColor: accentColor, baseColor: baseColor, preview: preview)
|
|
case .nightAccent:
|
|
theme = makeDarkAccentPresentationTheme(accentColor: accentColor, baseColor: baseColor, preview: preview)
|
|
case .day:
|
|
theme = makeDefaultDayPresentationTheme(accentColor: accentColor, serviceBackgroundColor: serviceBackgroundColor, baseColor: baseColor, day: true, preview: preview)
|
|
}
|
|
case let .local(resource):
|
|
theme = makeDefaultDayPresentationTheme(serviceBackgroundColor: serviceBackgroundColor, baseColor: baseColor, day: false, preview: preview)
|
|
case let .cloud(info):
|
|
theme = makeDefaultDayPresentationTheme(serviceBackgroundColor: serviceBackgroundColor, baseColor: baseColor, day: false, preview: preview)
|
|
}
|
|
return theme
|
|
}
|