mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Restore theme color list, add gradients
This commit is contained in:
parent
a63f2fb104
commit
cd5935b61d
@ -52,7 +52,7 @@ final class SettingsThemeWallpaperNode: ASDisplayNode {
|
||||
self.displayLoading = displayLoading
|
||||
self.imageNode.contentAnimations = [.subsequentUpdates]
|
||||
|
||||
self.statusNode = RadialStatusNode(backgroundNodeColor: overlayBackgroundColor, enableBlur: true)
|
||||
self.statusNode = RadialStatusNode(backgroundNodeColor: UIColor(white: 0.0, alpha: 0.2), enableBlur: true)
|
||||
let progressDiameter: CGFloat = 50.0
|
||||
self.statusNode.frame = CGRect(x: 0.0, y: 0.0, width: progressDiameter, height: progressDiameter)
|
||||
self.statusNode.isUserInteractionEnabled = false
|
||||
|
@ -11,79 +11,93 @@ import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
import AccountContext
|
||||
|
||||
private func availableColors(theme: PresentationTheme) -> [UInt32] {
|
||||
private func availableGradients(theme: PresentationTheme) -> [[UInt32]] {
|
||||
if theme.overallDarkAppearance {
|
||||
return ([
|
||||
0xffffff,
|
||||
0xd4dfea,
|
||||
0xb3cde1,
|
||||
0x6ab7ea,
|
||||
0x008dd0,
|
||||
0xd3e2da,
|
||||
0xc8e6c9,
|
||||
0xc5e1a5,
|
||||
0x61b06e,
|
||||
0xcdcfaf,
|
||||
0xa7a895,
|
||||
0x7c6f72,
|
||||
0xffd7ae,
|
||||
0xffb66d,
|
||||
0xde8751,
|
||||
0xefd5e0,
|
||||
0xdba1b9,
|
||||
0xffafaf,
|
||||
0xf16a60,
|
||||
0xe8bcea,
|
||||
0x9592ed,
|
||||
0xd9bc60,
|
||||
0xb17e49,
|
||||
0xd5cef7,
|
||||
0xdf506b,
|
||||
0x8bd2cc,
|
||||
0x3c847e,
|
||||
0x22612c,
|
||||
0x244d7c,
|
||||
0x3d3b85,
|
||||
0x65717d,
|
||||
0x18222d,
|
||||
0x000000
|
||||
] as [UInt32]).filter { color in
|
||||
return UIColor(rgb: color).hsb.b <= 0.4
|
||||
}
|
||||
return [
|
||||
[0x1e3557, 0x151a36, 0x1c4352, 0x2a4541] as [UInt32],
|
||||
[0x1d223f, 0x1d1832, 0x1b2943, 0x141631] as [UInt32],
|
||||
[0x203439, 0x102028, 0x1d3c3a, 0x172635] as [UInt32],
|
||||
[0x1c2731, 0x1a1c25, 0x27303b, 0x1b1b21] as [UInt32],
|
||||
[0x3a1c3a, 0x24193c, 0x392e3e, 0x1a1632] as [UInt32],
|
||||
[0x2c211b, 0x44332a, 0x22191f, 0x3b2d36] as [UInt32],
|
||||
[0x1e3557, 0x182036, 0x1c4352, 0x16263a] as [UInt32],
|
||||
[0x111236, 0x14424f, 0x0b2334, 0x3b315d] as [UInt32],
|
||||
[0x2d4836, 0x172b19, 0x364331, 0x103231] as [UInt32]
|
||||
]
|
||||
} else {
|
||||
return [
|
||||
0xffffff,
|
||||
0xd4dfea,
|
||||
0xb3cde1,
|
||||
0x6ab7ea,
|
||||
0x008dd0,
|
||||
0xd3e2da,
|
||||
0xc8e6c9,
|
||||
0xc5e1a5,
|
||||
0x61b06e,
|
||||
0xcdcfaf,
|
||||
0xa7a895,
|
||||
0x7c6f72,
|
||||
0xffd7ae,
|
||||
0xffb66d,
|
||||
0xde8751,
|
||||
0xefd5e0,
|
||||
0xdba1b9,
|
||||
0xffafaf,
|
||||
0xf16a60,
|
||||
0xe8bcea,
|
||||
0x9592ed,
|
||||
0xd9bc60,
|
||||
0xb17e49,
|
||||
0xd5cef7,
|
||||
0xdf506b,
|
||||
0x8bd2cc,
|
||||
0x3c847e,
|
||||
0x22612c,
|
||||
0x244d7c,
|
||||
0x3d3b85,
|
||||
0x65717d,
|
||||
0x18222d,
|
||||
[0xdbddbb, 0x6ba587, 0xd5d88d, 0x88b884] as [UInt32],
|
||||
[0x8dc0eb, 0xb9d1ea, 0xc6b1ef, 0xebd7ef] as [UInt32],
|
||||
[0x97beeb, 0xb1e9ea, 0xc6b1ef, 0xefb7dc] as [UInt32],
|
||||
[0x8adbf2, 0x888dec, 0xe39fea, 0x679ced] as [UInt32],
|
||||
[0xb0cdeb, 0x9fb0ea, 0xbbead5, 0xb2e3dd] as [UInt32],
|
||||
[0xdaeac8, 0xa2b4ff, 0xeccbff, 0xb9e2ff] as [UInt32],
|
||||
[0xdceb92, 0x8fe1d6, 0x67a3f2, 0x85d685] as [UInt32],
|
||||
[0xeaa36e, 0xf0e486, 0xf29ebf, 0xe8c06e] as [UInt32],
|
||||
[0xffc3b2, 0xe2c0ff, 0xffe7b2, 0xf8cece] as [UInt32]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
private func availableColors(theme: PresentationTheme) -> [UInt32] {
|
||||
if theme.overallDarkAppearance {
|
||||
return [
|
||||
0x1D2D3C,
|
||||
0x111B26,
|
||||
0x0B141E,
|
||||
0x1F361F,
|
||||
0x131F15,
|
||||
0x0E1710,
|
||||
0x2F2E27,
|
||||
0x2A261F,
|
||||
0x191817,
|
||||
0x432E30,
|
||||
0x2E1C1E,
|
||||
0x1F1314,
|
||||
0x432E3C,
|
||||
0x2E1C28,
|
||||
0x1F131B,
|
||||
0x3C2E43,
|
||||
0x291C2E,
|
||||
0x1D1221,
|
||||
0x312E43,
|
||||
0x1E1C2E,
|
||||
0x141221,
|
||||
0x2F3F3F,
|
||||
0x212D30,
|
||||
0x141E20,
|
||||
0x272524,
|
||||
0x191716,
|
||||
0x000000
|
||||
]
|
||||
} else {
|
||||
return [
|
||||
0xD3DFEA,
|
||||
0xA5C5DB,
|
||||
0x6F99C8,
|
||||
0xD2E3A9,
|
||||
0xA4D48E,
|
||||
0x7DBB6E,
|
||||
0xE6DDAE,
|
||||
0xD5BE91,
|
||||
0xCBA479,
|
||||
0xEBC0B9,
|
||||
0xE0A79D,
|
||||
0xC97870,
|
||||
0xEBB9C8,
|
||||
0xE09DB7,
|
||||
0xD27593,
|
||||
0xDAC2ED,
|
||||
0xD3A5E7,
|
||||
0xB587D2,
|
||||
0xC2C2ED,
|
||||
0xA5A5E7,
|
||||
0x7F7FD0,
|
||||
0xC2E2ED,
|
||||
0xA5D6E7,
|
||||
0x7FBAD0,
|
||||
0xD6C2B9,
|
||||
0x9C8882,
|
||||
0x000000
|
||||
]
|
||||
}
|
||||
@ -155,7 +169,7 @@ final class ThemeColorsGridController: ViewController {
|
||||
}
|
||||
|
||||
override func loadDisplayNode() {
|
||||
self.displayNode = ThemeColorsGridControllerNode(context: self.context, presentationData: self.presentationData, colors: availableColors(theme: self.presentationData.theme), present: { [weak self] controller, arguments in
|
||||
self.displayNode = ThemeColorsGridControllerNode(context: self.context, presentationData: self.presentationData, gradients: availableGradients(theme: self.presentationData.theme), colors: availableColors(theme: self.presentationData.theme), present: { [weak self] controller, arguments in
|
||||
self?.present(controller, in: .window(.root), with: arguments, blockInteraction: true)
|
||||
}, pop: { [weak self] in
|
||||
if let strongSelf = self, let navigationController = strongSelf.navigationController as? NavigationController {
|
||||
|
@ -88,7 +88,7 @@ final class ThemeColorsGridControllerNode: ASDisplayNode {
|
||||
|
||||
private var disposable: Disposable?
|
||||
|
||||
init(context: AccountContext, presentationData: PresentationData, colors: [UInt32], present: @escaping (ViewController, Any?) -> Void, pop: @escaping () -> Void, presentColorPicker: @escaping () -> Void) {
|
||||
init(context: AccountContext, presentationData: PresentationData, gradients: [[UInt32]], colors: [UInt32], present: @escaping (ViewController, Any?) -> Void, pop: @escaping () -> Void, presentColorPicker: @escaping () -> Void) {
|
||||
self.context = context
|
||||
self.presentationData = presentationData
|
||||
self.present = present
|
||||
@ -142,7 +142,9 @@ final class ThemeColorsGridControllerNode: ASDisplayNode {
|
||||
})
|
||||
self.controllerInteraction = interaction
|
||||
|
||||
let wallpapers = colors.map { TelegramWallpaper.color($0) }
|
||||
var wallpapers: [TelegramWallpaper] = []
|
||||
wallpapers.append(contentsOf: gradients.map { TelegramWallpaper.gradient(nil, $0, WallpaperSettings()) })
|
||||
wallpapers.append(contentsOf: colors.map { TelegramWallpaper.color($0) })
|
||||
let transition = context.sharedContext.presentationData
|
||||
|> map { presentationData -> (ThemeColorsGridEntryTransition, Bool) in
|
||||
var entries: [ThemeColorsGridControllerEntry] = []
|
||||
|
@ -145,12 +145,12 @@ final class ThemeGridController: ViewController {
|
||||
})
|
||||
}
|
||||
}, presentColors: { [weak self] in
|
||||
/*if let strongSelf = self {
|
||||
if let strongSelf = self {
|
||||
let controller = ThemeColorsGridController(context: strongSelf.context)
|
||||
(strongSelf.navigationController as? NavigationController)?.pushViewController(controller)
|
||||
}*/
|
||||
}
|
||||
|
||||
if let strongSelf = self {
|
||||
/*if let strongSelf = self {
|
||||
let _ = (strongSelf.context.sharedContext.accountManager.sharedData(keys: [ApplicationSpecificSharedDataKeys.presentationThemeSettings])
|
||||
|> take(1)
|
||||
|> deliverOnMainQueue).start(next: { [weak self] sharedData in
|
||||
@ -189,7 +189,7 @@ final class ThemeGridController: ViewController {
|
||||
}
|
||||
strongSelf.push(controller)
|
||||
})
|
||||
}
|
||||
}*/
|
||||
}, emptyStateUpdated: { [weak self] empty in
|
||||
if let strongSelf = self {
|
||||
if empty != strongSelf.isEmpty {
|
||||
|
@ -280,7 +280,6 @@ final class WallpaperPatternPanelNode: ASDisplayNode {
|
||||
if existingIds.contains(file.file.fileId) {
|
||||
return false
|
||||
} else {
|
||||
print("slug: \(file.slug)")
|
||||
existingIds.insert(file.file.fileId)
|
||||
return true
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user