Don't blur if not necessary

This commit is contained in:
Ali 2021-06-15 19:31:26 +04:00
parent 16e483d3d5
commit c193230b29
20 changed files with 65 additions and 60 deletions

View File

@ -109,7 +109,7 @@ final class SettingsThemeWallpaperNode: ASDisplayNode {
var colors: [UInt32] = []
var intensity: CGFloat = 0.5
if case let .gradient(value, _) = wallpaper {
if case let .gradient(_, value, _) = wallpaper {
colors = value
} else if case let .file(file) = wallpaper {
colors = file.settings.colors

View File

@ -164,7 +164,7 @@ final class ThemeAccentColorController: ViewController {
if let patternWallpaper = state.patternWallpaper {
coloredWallpaper = patternWallpaper.withUpdatedSettings(WallpaperSettings(colors: state.backgroundColors, intensity: state.patternIntensity, rotation: state.rotation))
} else if state.backgroundColors.count >= 2 {
coloredWallpaper = .gradient(state.backgroundColors, WallpaperSettings(rotation: state.rotation))
coloredWallpaper = .gradient(nil, state.backgroundColors, WallpaperSettings(rotation: state.rotation))
} else {
coloredWallpaper = .color(state.backgroundColors[0])
}
@ -425,7 +425,7 @@ final class ThemeAccentColorController: ViewController {
rotation = file.settings.rotation ?? 0
} else if case let .color(color) = wallpaper {
backgroundColors = [color]
} else if case let .gradient(colors, settings) = wallpaper {
} else if case let .gradient(_, colors, settings) = wallpaper {
backgroundColors = colors
motion = settings.motion
rotation = settings.rotation ?? 0

View File

@ -458,7 +458,7 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate
}
convertedRepresentations.append(ImageRepresentationWithReference(representation: .init(dimensions: dimensions, resource: file.file.resource, progressiveSizes: [], immediateThumbnailData: nil), reference: .wallpaper(wallpaper: .slug(file.slug), resource: file.file.resource)))
} else if backgroundColors.count >= 2 {
wallpaper = .gradient(backgroundColors, WallpaperSettings(rotation: state.rotation))
wallpaper = .gradient(nil, backgroundColors, WallpaperSettings(rotation: state.rotation))
} else {
wallpaper = .color(backgroundColors.first ?? 0xffffff)
}
@ -468,7 +468,7 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate
case .dayClassic:
let topColor = accentColor.withMultiplied(hue: 1.010, saturation: 0.414, brightness: 0.957)
let bottomColor = accentColor.withMultiplied(hue: 1.019, saturation: 0.867, brightness: 0.965)
suggestedWallpaper = .gradient([topColor.rgb, bottomColor.rgb], WallpaperSettings())
suggestedWallpaper = .gradient(nil, [topColor.rgb, bottomColor.rgb], WallpaperSettings())
backgroundColors = [topColor.rgb, bottomColor.rgb]
case .nightAccent:
let color = accentColor.withMultiplied(hue: 1.024, saturation: 0.573, brightness: 0.18)

View File

@ -61,7 +61,7 @@ struct ThemeGridControllerEntry: Comparable, Identifiable {
return .builtin
case let .color(color):
return .color(color)
case let .gradient(colors, _):
case let .gradient(_, colors, _):
return .gradient(colors)
case let .file(id, _, _, _, _, _, _, _, settings):
return .file(id, settings.colors, settings.intensity ?? 0)
@ -411,6 +411,10 @@ final class ThemeGridControllerNode: ASDisplayNode {
}
}
}
if entries.count >= 4 {
entries = Array(entries[0 ..< 4])
}
let previous = previousEntries.swap(entries)
return (preparedThemeGridEntryTransition(context: context, from: previous ?? [], to: entries, interaction: interaction), previous == nil)

View File

@ -192,7 +192,7 @@ final class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate {
if file.settings.blur {
self.chatContainerNode.insertSubnode(self.blurredNode, belowSubnode: self.messagesContainerNode)
}
} else if case let .gradient(colors, _) = self.wallpaper {
} else if case let .gradient(_, colors, _) = self.wallpaper {
gradientColors = colors
}

View File

@ -627,7 +627,7 @@ public class WallpaperGalleryController: ViewController {
switch initialWallpaper {
case let .color(color):
strongSelf.patternPanelNode?.backgroundColors = ([color], nil, nil)
case let .gradient(colors, settings):
case let .gradient(_, colors, settings):
strongSelf.patternPanelNode?.backgroundColors = (colors, settings.rotation, nil)
case let .file(file) where file.isPattern:
strongSelf.patternPanelNode?.backgroundColors = (file.settings.colors, file.settings.rotation, file.settings.intensity)
@ -647,7 +647,7 @@ public class WallpaperGalleryController: ViewController {
case let .file(file):
if !file.settings.colors.isEmpty {
if file.settings.colors.count >= 2 {
strongSelf.updateEntries(wallpaper: .gradient(file.settings.colors, WallpaperSettings(rotation: file.settings.rotation)))
strongSelf.updateEntries(wallpaper: .gradient(nil, file.settings.colors, WallpaperSettings(rotation: file.settings.rotation)))
} else {
strongSelf.updateEntries(wallpaper: .color(file.settings.colors[0]))
}
@ -782,7 +782,7 @@ public class WallpaperGalleryController: ViewController {
entryColors = [color]
} else if case let .file(file) = wallpaper, file.isPattern {
entryColors = file.settings.colors
} else if case let .gradient(colors, _) = wallpaper {
} else if case let .gradient(_, colors, _) = wallpaper {
entryColors = colors
}
}
@ -797,7 +797,7 @@ public class WallpaperGalleryController: ViewController {
let newWallpaper = TelegramWallpaper.color(entryColors[0])
updatedEntries.append(.wallpaper(newWallpaper, nil))
} else {
let newWallpaper = TelegramWallpaper.gradient(entryColors, WallpaperSettings(rotation: nil))
let newWallpaper = TelegramWallpaper.gradient(nil, entryColors, WallpaperSettings(rotation: nil))
updatedEntries.append(.wallpaper(newWallpaper, nil))
}
}
@ -847,7 +847,7 @@ public class WallpaperGalleryController: ViewController {
case let .file(file):
colors = file.settings.colors
rotation = file.settings.rotation
case let .gradient(colorsValue, settings):
case let .gradient(_, colorsValue, settings):
colors = colorsValue
rotation = settings.rotation
default:
@ -893,7 +893,7 @@ public class WallpaperGalleryController: ViewController {
return
}
var wallpaper: TelegramWallpaper = .gradient(colors, WallpaperSettings(blur: false, motion: false, colors: [], intensity: nil, rotation: nil))
var wallpaper: TelegramWallpaper = .gradient(nil, colors, WallpaperSettings(blur: false, motion: false, colors: [], intensity: nil, rotation: nil))
if case let .file(file) = currentWallpaper {
wallpaper = currentWallpaper.withUpdatedSettings(WallpaperSettings(blur: false, motion: false, colors: colors, intensity: file.settings.intensity, rotation: file.settings.rotation))
@ -1011,7 +1011,7 @@ public class WallpaperGalleryController: ViewController {
controller = ShareController(context: context, subject: .url("https://t.me/bg/\(slug)\(optionsString)"))
case let .color(color):
controller = ShareController(context: context, subject: .url("https://t.me/bg/\(UIColor(rgb: color).hexString)"))
case let .gradient(colors, _):
case let .gradient(_, colors, _):
var colorsString = ""
for color in colors {

View File

@ -311,7 +311,7 @@ final class WallpaperGalleryItemNode: GalleryItemNode {
} else {
self.playButtonNode.setImage(self.playButtonRotateImage, for: [])
}
} else if case let .gradient(colors, _) = wallpaper {
} else if case let .gradient(_, colors, _) = wallpaper {
self.nativeNode.isHidden = false
self.nativeNode.update(wallpaper: wallpaper)
self.patternButtonNode.isSelected = false
@ -360,7 +360,7 @@ final class WallpaperGalleryItemNode: GalleryItemNode {
actionSignal = .single(defaultAction)
colorSignal = chatServiceBackgroundColor(wallpaper: wallpaper, mediaBox: self.context.account.postbox.mediaBox)
isBlurrable = false
case let .gradient(colors, settings):
case let .gradient(_, colors, settings):
displaySize = CGSize(width: 1.0, height: 1.0)
contentSize = displaySize
signal = .single({ _ in nil })
@ -801,7 +801,7 @@ final class WallpaperGalleryItemNode: GalleryItemNode {
} else {
return nil
}
case let .gradient(colors, _):
case let .gradient(_, colors, _):
return colors.map(UIColor.init(rgb:))
case let .color(color):
return [UIColor(rgb: color)]
@ -825,7 +825,7 @@ final class WallpaperGalleryItemNode: GalleryItemNode {
return
}
switch wallpaper {
case let .gradient(colors, settings):
case let .gradient(_, colors, settings):
if colors.count >= 3 {
self.nativeNode.animateEvent(transition: .animated(duration: 0.5, curve: .spring))
} else {
@ -973,7 +973,7 @@ final class WallpaperGalleryItemNode: GalleryItemNode {
blurFrame = leftButtonFrame
motionAlpha = 1.0
motionFrame = rightButtonFrame
case let .gradient(colors, _):
case let .gradient(_, colors, _):
motionAlpha = 0.0
patternAlpha = 1.0
@ -1076,7 +1076,7 @@ final class WallpaperGalleryItemNode: GalleryItemNode {
if file.settings.colors.count >= 3 {
hasAnimatableGradient = true
}
case let .gradient(colors, _):
case let .gradient(_, colors, _):
if colors.count >= 3 {
hasAnimatableGradient = true
}
@ -1098,7 +1098,7 @@ final class WallpaperGalleryItemNode: GalleryItemNode {
if file.settings.colors.count >= 3 {
hasAnimatableGradient = true
}
case let .gradient(colors, _):
case let .gradient(_, colors, _):
if colors.count >= 3 {
hasAnimatableGradient = true
}

View File

@ -71,7 +71,7 @@ public struct WallpaperSettings: PostboxCoding, Equatable {
public enum TelegramWallpaper: OrderedItemListEntryContents, Equatable {
case builtin(WallpaperSettings)
case color(UInt32)
case gradient([UInt32], WallpaperSettings)
case gradient(Int64?, [UInt32], WallpaperSettings)
case image([TelegramMediaImageRepresentation], WallpaperSettings)
case file(id: Int64, accessHash: Int64, isCreator: Bool, isDefault: Bool, isPattern: Bool, isDark: Bool, slug: String, file: TelegramMediaFile, settings: WallpaperSettings)
@ -106,7 +106,7 @@ public enum TelegramWallpaper: OrderedItemListEntryContents, Equatable {
colors = decoder.decodeInt32ArrayForKey("colors").map(UInt32.init(bitPattern:))
}
self = .gradient(colors, settings)
self = .gradient(decoder.decodeOptionalInt64ForKey("id"), colors, settings)
default:
assertionFailure()
self = .color(0xffffff)
@ -130,8 +130,13 @@ public enum TelegramWallpaper: OrderedItemListEntryContents, Equatable {
case let .color(color):
encoder.encodeInt32(1, forKey: "v")
encoder.encodeInt32(Int32(bitPattern: color), forKey: "c")
case let .gradient(colors, settings):
case let .gradient(id, colors, settings):
encoder.encodeInt32(4, forKey: "v")
if let id = id {
encoder.encodeInt64(id, forKey: "id")
} else {
encoder.encodeNil(forKey: "id")
}
encoder.encodeInt32Array(colors.map(Int32.init(bitPattern:)), forKey: "colors")
encoder.encodeObject(settings, forKey: "settings")
case let .image(representations, settings):
@ -166,8 +171,8 @@ public enum TelegramWallpaper: OrderedItemListEntryContents, Equatable {
} else {
return false
}
case let .gradient(colors, settings):
if case .gradient(colors, settings) = rhs {
case let .gradient(id, colors, settings):
if case .gradient(id, colors, settings) = rhs {
return true
} else {
return false
@ -201,8 +206,8 @@ public enum TelegramWallpaper: OrderedItemListEntryContents, Equatable {
} else {
return false
}
case let .gradient(colors, _):
if case .gradient(colors, _) = wallpaper {
case let .gradient(_, colors, _):
if case .gradient(_, colors, _) = wallpaper {
return true
} else {
return false
@ -224,7 +229,7 @@ public enum TelegramWallpaper: OrderedItemListEntryContents, Equatable {
public var settings: WallpaperSettings? {
switch self {
case let .builtin(settings), let .gradient(_, settings), let .image(_, settings), let .file(_, _, _, _, _, _, _, _, settings):
case let .builtin(settings), let .gradient(_, _, settings), let .image(_, settings), let .file(_, _, _, _, _, _, _, _, settings):
return settings
default:
return nil
@ -237,8 +242,8 @@ public enum TelegramWallpaper: OrderedItemListEntryContents, Equatable {
return .builtin(settings)
case .color:
return self
case let .gradient(colors, _):
return .gradient(colors, settings)
case let .gradient(id, colors, _):
return .gradient(id, colors, settings)
case let .image(representations, _):
return .image(representations, settings)
case let .file(id, accessHash, isCreator, isDefault, isPattern, isDark, slug, file, _):

View File

@ -77,13 +77,13 @@ extension TelegramWallpaper {
//assertionFailure()
self = .color(0xffffff)
}
case let .wallPaperNoFile(_, _, settings):
case let .wallPaperNoFile(id, _, settings):
if let settings = settings, case let .wallPaperSettings(_, backgroundColor, secondBackgroundColor, thirdBackgroundColor, fourthBackgroundColor, _, rotation) = settings {
let colors: [UInt32] = ([backgroundColor, secondBackgroundColor, thirdBackgroundColor, fourthBackgroundColor] as [Int32?]).compactMap({ color -> UInt32? in
return color.flatMap(UInt32.init(bitPattern:))
})
if colors.count > 1 {
self = .gradient(colors, WallpaperSettings(rotation: rotation))
self = .gradient(id, colors, WallpaperSettings(rotation: rotation))
} else if colors.count == 1 {
self = .color(UInt32(bitPattern: colors[0]))
} else {
@ -104,8 +104,8 @@ extension TelegramWallpaper {
return (.inputWallPaperSlug(slug: slug), apiWallpaperSettings(settings))
case let .color(color):
return (.inputWallPaperNoFile(id: 0), apiWallpaperSettings(WallpaperSettings(colors: [color])))
case let .gradient(colors, settings):
return (.inputWallPaperNoFile(id: 0), apiWallpaperSettings(WallpaperSettings(colors: colors, rotation: settings.rotation)))
case let .gradient(id, colors, settings):
return (.inputWallPaperNoFile(id: id ?? 0), apiWallpaperSettings(WallpaperSettings(colors: colors, rotation: settings.rotation)))
default:
return nil
}

View File

@ -43,7 +43,7 @@ public func chatControllerBackgroundImage(theme: PresentationTheme?, wallpaper i
context.setFillColor(UIColor(argb: color).withAlphaComponent(1.0).cgColor)
context.fill(CGRect(origin: CGPoint(), size: size))
})
case let .gradient(colors, settings):
case let .gradient(_, colors, settings):
backgroundImage = generateImage(CGSize(width: 640.0, height: 1280.0), rotatedContext: { size, context in
let gradientColors = [UIColor(argb: colors.count >= 1 ? colors[0] : 0).cgColor, UIColor(argb: colors.count >= 2 ? colors[1] : 0).cgColor] as CFArray
@ -135,7 +135,7 @@ public func chatControllerBackgroundImageSignal(wallpaper: TelegramWallpaper, me
|> afterNext { image in
cacheWallpaper(image?.0)
}
case let .gradient(colors, settings):
case let .gradient(_, colors, settings):
return .single((generateImage(CGSize(width: 640.0, height: 1280.0).fitted(CGSize(width: 100.0, height: 100.0)), rotatedContext: { size, context in
let gradientColors = [UIColor(rgb: colors.count >= 1 ? colors[0] : 0).cgColor, UIColor(rgb: colors.count >= 2 ? colors[1] : 0).cgColor] as CFArray
@ -192,7 +192,7 @@ public func chatControllerBackgroundImageSignal(wallpaper: TelegramWallpaper, me
} else {
let interimWallpaper: TelegramWallpaper
if file.settings.colors.count >= 2 {
interimWallpaper = .gradient(file.settings.colors, file.settings)
interimWallpaper = .gradient(nil, file.settings.colors, file.settings)
} else {
interimWallpaper = .color(file.settings.colors.count >= 1 ? file.settings.colors[0] : 0)
}

View File

@ -84,7 +84,7 @@ public func customizeDefaultDarkPresentationTheme(theme: PresentationTheme, edit
defaultWallpaper = forcedWallpaper
} else if !backgroundColors.isEmpty {
if backgroundColors.count >= 2 {
defaultWallpaper = .gradient(backgroundColors, WallpaperSettings())
defaultWallpaper = .gradient(nil, backgroundColors, WallpaperSettings())
} else {
defaultWallpaper = .color(backgroundColors[0])
}

View File

@ -230,7 +230,7 @@ public func customizeDefaultDarkTintedPresentationTheme(theme: PresentationTheme
defaultWallpaper = forcedWallpaper
} else if !backgroundColors.isEmpty {
if backgroundColors.count >= 2 {
defaultWallpaper = .gradient(backgroundColors, WallpaperSettings())
defaultWallpaper = .gradient(nil, backgroundColors, WallpaperSettings())
} else {
defaultWallpaper = .color(backgroundColors[0])
}

View File

@ -60,10 +60,10 @@ public func customizeDefaultDayTheme(theme: PresentationTheme, editing: Bool, ti
outgoingAccent = accentColor
}
suggestedWallpaper = .gradient(defaultBuiltinWallpaperGradientColors.map(\.rgb), WallpaperSettings())
suggestedWallpaper = .gradient(nil, defaultBuiltinWallpaperGradientColors.map(\.rgb), WallpaperSettings())
} else {
bubbleColors = (UIColor(rgb: 0xe1ffc7), nil)
suggestedWallpaper = .gradient(defaultBuiltinWallpaperGradientColors.map(\.rgb), WallpaperSettings())
suggestedWallpaper = .gradient(nil, defaultBuiltinWallpaperGradientColors.map(\.rgb), WallpaperSettings())
}
}
}
@ -222,7 +222,7 @@ public func customizeDefaultDayTheme(theme: PresentationTheme, editing: Bool, ti
defaultWallpaper = forcedWallpaper
} else if !backgroundColors.isEmpty {
if backgroundColors.count >= 2 {
defaultWallpaper = .gradient(backgroundColors, WallpaperSettings())
defaultWallpaper = .gradient(nil, backgroundColors, WallpaperSettings())
} else {
defaultWallpaper = .color(backgroundColors[0])
}

View File

@ -444,7 +444,7 @@ public func serviceColor(for wallpaper: (TelegramWallpaper, UIImage?)) -> UIColo
return UIColor(rgb: 0x748391, alpha: 0.45)
case let .color(color):
return serviceColor(with: UIColor(argb: color))
case let .gradient(colors, _):
case let .gradient(_, colors, _):
if colors.count == 2 {
let mixedColor = UIColor(argb: colors[0]).mixedWith(UIColor(argb: colors[1]), alpha: 0.5)
return serviceColor(with: mixedColor)
@ -503,7 +503,7 @@ public func chatServiceBackgroundColor(wallpaper: TelegramWallpaper, mediaBox: M
return .single(UIColor(rgb: 0x000000, alpha: 0.2))
case let .color(color):
return .single(serviceColor(with: UIColor(argb: color)))
case let .gradient(colors, _):
case let .gradient(_, colors, _):
if colors.count == 2 {
let mixedColor = UIColor(argb: colors[0]).mixedWith(UIColor(argb: colors[1]), alpha: 0.5)
return .single(

View File

@ -65,7 +65,7 @@ extension TelegramWallpaper: Codable {
}
}
self = .gradient([topColor.argb, bottomColor.argb], WallpaperSettings(blur: blur, motion: motion, rotation: rotation))
self = .gradient(nil, [topColor.argb, bottomColor.argb], WallpaperSettings(blur: blur, motion: motion, rotation: rotation))
} else {
var slug: String?
var colors: [UInt32] = []
@ -118,7 +118,7 @@ extension TelegramWallpaper: Codable {
try container.encode("builtin")
case let .color(color):
try container.encode(String(format: "%06x", color))
case let .gradient(colors, settings):
case let .gradient(_, colors, settings):
var components: [String] = []
for color in colors {
components.append(String(format: "%06x", color))

View File

@ -1398,7 +1398,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
switch item.presentationData.theme.wallpaper {
case .color:
hasSolidWallpaper = true
case let .gradient(colors, _):
case let .gradient(_, colors, _):
hasSolidWallpaper = colors.count <= 2
default:
break

View File

@ -263,7 +263,7 @@ func openChatWallpaper(context: AccountContext, message: Message, present: @esca
case let .color(color):
source = .wallpaper(.color(color.argb), nil, [], nil, nil, message)
case let .gradient(colors, rotation):
source = .wallpaper(.gradient(colors, WallpaperSettings(rotation: rotation)), nil, [], nil, rotation, message)
source = .wallpaper(.gradient(nil, colors, WallpaperSettings(rotation: rotation)), nil, [], nil, rotation, message)
}
let controller = WallpaperGalleryController(context: context, source: source)

View File

@ -309,7 +309,7 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
case let .color(color):
signal = .single(.color(color.argb))
case let .gradient(colors, rotation):
signal = .single(.gradient(colors, WallpaperSettings(rotation: rotation)))
signal = .single(.gradient(nil, colors, WallpaperSettings(rotation: rotation)))
}
let _ = (signal

View File

@ -103,7 +103,7 @@ public final class WallpaperBackgroundNode: ASDisplayNode {
if !isPattern {
needsCleanBackground = false
}
case let .gradient(colors, _):
case let .gradient(_, colors, _):
hasComplexGradient = colors.count >= 3
default:
break
@ -381,7 +381,7 @@ public final class WallpaperBackgroundNode: ASDisplayNode {
if case let .color(color) = wallpaper {
gradientColors = [color]
self._isReady.set(true)
} else if case let .gradient(colors, settings) = wallpaper {
} else if case let .gradient(_, colors, settings) = wallpaper {
gradientColors = colors
gradientAngle = settings.rotation ?? 0
self._isReady.set(true)

View File

@ -286,10 +286,6 @@ public func wallpaperImage(account: Account, accountManager: AccountManager, fil
blurredThumbnailImage = thumbnailContext.generateImage()
}
}
if blurredThumbnailImage != nil {
fullSizeImage = nil
}
if let blurredThumbnailImage = blurredThumbnailImage, fullSizeImage == nil {
let context = DrawingContext(size: blurredThumbnailImage.size, scale: blurredThumbnailImage.scale, clear: true)
@ -876,7 +872,7 @@ public func drawThemeImage(context c: CGContext, theme: PresentationTheme, wallp
case let .color(color):
c.setFillColor(UIColor(rgb: color).cgColor)
c.fill(drawingRect)
case let .gradient(colors, _):
case let .gradient(_, colors, _):
if colors.count >= 3 {
let image = GradientBackgroundNode.generatePreview(size: CGSize(width: 60.0, height: 60.0), colors: colors.map(UIColor.init(rgb:)))
c.draw(image.cgImage!, in: drawingRect)
@ -1254,7 +1250,7 @@ public func themeIconImage(account: Account, accountManager: AccountManager, the
if file.settings.colors.count >= 2 {
bottomBackgroundColor = UIColor(rgb: file.settings.colors[1])
}
} else if let wallpaper = wallpaper, case let .gradient(colors, _) = wallpaper {
} else if let wallpaper = wallpaper, case let .gradient(_, colors, _) = wallpaper {
topBackgroundColor = colors.first.flatMap { UIColor(rgb: $0) } ?? UIColor(rgb: 0xd6e2ee)
if colors.count >= 2 {
bottomBackgroundColor = UIColor(rgb: colors[1])
@ -1294,7 +1290,7 @@ public func themeIconImage(account: Account, accountManager: AccountManager, the
case let .color(color):
colors = [color]
topBackgroundColor = UIColor(rgb: color)
case let .gradient(colorsValue, settings):
case let .gradient(_, colorsValue, settings):
colors = colorsValue
if colors.count >= 1 {
topBackgroundColor = UIColor(rgb: colors[0])
@ -1373,7 +1369,7 @@ public func themeIconImage(account: Account, accountManager: AccountManager, the
backgroundColor = (UIColor(rgb: 0xd6e2ee), nil, [])
case let .color(color):
backgroundColor = (UIColor(rgb: color), nil, [])
case let .gradient(colors, settings):
case let .gradient(_, colors, settings):
if colors.count >= 2 {
backgroundColor = (UIColor(rgb: colors[0]), UIColor(rgb: colors[1]), colors)
} else {