mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Various improvements
This commit is contained in:
@@ -48,7 +48,7 @@ public final class EmojiStatusComponent: Component {
|
||||
case verified(fillColor: UIColor, foregroundColor: UIColor, sizeType: SizeType)
|
||||
case text(color: UIColor, string: String)
|
||||
case animation(content: AnimationContent, size: CGSize, placeholderColor: UIColor, themeColor: UIColor?, loopMode: LoopMode)
|
||||
case topic(title: String, colorIndex: Int, size: CGSize)
|
||||
case topic(title: String, color: Int32, size: CGSize)
|
||||
}
|
||||
|
||||
public let context: AccountContext
|
||||
@@ -223,7 +223,7 @@ public final class EmojiStatusComponent: Component {
|
||||
} else {
|
||||
iconImage = nil
|
||||
}
|
||||
case let .topic(title, colorIndex, size):
|
||||
case let .topic(title, color, size):
|
||||
func generateTopicIcon(backgroundColors: [UIColor], strokeColors: [UIColor]) -> UIImage? {
|
||||
return generateImage(size, rotatedContext: { size, context in
|
||||
context.clear(CGRect(origin: .zero, size: size))
|
||||
@@ -283,18 +283,21 @@ public final class EmojiStatusComponent: Component {
|
||||
})
|
||||
}
|
||||
|
||||
let topicColors: [([UInt32], [UInt32])] = [
|
||||
([0x6FB9F0, 0x0261E4], [0x026CB5, 0x064BB7]),
|
||||
([0x6FB9F0, 0x0261E4], [0x026CB5, 0x064BB7]),
|
||||
([0xFFD67E, 0xFC8601], [0xDA9400, 0xFA5F00]),
|
||||
([0xCB86DB, 0x9338AF], [0x812E98, 0x6F2B87]),
|
||||
([0x8EEE98, 0x02B504], [0x02A01B, 0x009716]),
|
||||
([0xFF93B2, 0xE23264], [0xFC447A, 0xC80C46]),
|
||||
([0xFB6F5F, 0xD72615], [0xDC1908, 0xB61506])
|
||||
]
|
||||
let clippedIndex = colorIndex % topicColors.count
|
||||
func generateTopicColors(_ color: Int32) -> ([UInt32], [UInt32]) {
|
||||
return ([0x6FB9F0, 0x0261E4], [0x026CB5, 0x064BB7])
|
||||
}
|
||||
|
||||
if let image = generateTopicIcon(backgroundColors: topicColors[clippedIndex].0.map(UIColor.init(rgb:)), strokeColors: topicColors[clippedIndex].1.map(UIColor.init(rgb:))) {
|
||||
let topicColors: [Int32: ([UInt32], [UInt32])] = [
|
||||
0x6FB9F0: ([0x6FB9F0, 0x0261E4], [0x026CB5, 0x064BB7]),
|
||||
0xFFD67E: ([0xFFD67E, 0xFC8601], [0xDA9400, 0xFA5F00]),
|
||||
0xCB86DB: ([0xCB86DB, 0x9338AF], [0x812E98, 0x6F2B87]),
|
||||
0x8EEE98: ([0x8EEE98, 0x02B504], [0x02A01B, 0x009716]),
|
||||
0xFF93B2: ([0xFF93B2, 0xE23264], [0xFC447A, 0xC80C46]),
|
||||
0xFB6F5F: ([0xFB6F5F, 0xD72615], [0xDC1908, 0xB61506])
|
||||
]
|
||||
let colors = topicColors[color] ?? generateTopicColors(color)
|
||||
|
||||
if let image = generateTopicIcon(backgroundColors: colors.0.map(UIColor.init(rgb:)), strokeColors: colors.1.map(UIColor.init(rgb:))) {
|
||||
iconImage = image
|
||||
} else {
|
||||
iconImage = nil
|
||||
|
||||
Reference in New Issue
Block a user