     }
 
 }
+
+extension MessagesViewController {
+    override func applyTheme() {
+        super.applyTheme()
+        guard let theme = view.theme else { return }
+        let themeName = ThemeManager.themes.first { $0.theme == theme }?.title
+        let scrollToBottomImageName = "Float Button " + (themeName ?? "light")
+        buttonScrollToBottom.setImage(UIImage(named: scrollToBottomImageName), for: .normal)
+    }
+}

                self?.collectionView.scrollToItem(at: indexPath, at: .bottom, animated: false)
            }
        })
    }

    func openURL(url: URL) {

        }
    }

    private let buttonScrollToBottomSize = CGFloat(70)
    lazy var buttonScrollToBottom: UIButton = {
        let button = UIButton()
        button.frame = CGRect(x: .greatestFiniteMagnitude, y: .greatestFiniteMagnitude, width: buttonScrollToBottomSize, height: buttonScrollToBottomSize)
        button.setImage(UIImage(named: "Float Button light"), for: .normal)
        button.addTarget(self, action: #selector(buttonScrollToBottomDidPressed), for: .touchUpInside)
        return button
    }()

    var scrollToBottomButtonIsVisible: Bool = false {
        didSet {
            guard oldValue != scrollToBottomButtonIsVisible
            else {
                return
            }

            func animates(_ animations: @escaping VoidCompletion) {
                UIView.animate(withDuration: 0.15, delay: 0, options: UIView.AnimationOptions(rawValue: 7 << 16), animations: {
                    animations()
                }, completion: nil)
            }

            if self.scrollToBottomButtonIsVisible {
                if buttonScrollToBottom.superview == nil {
                    view.addSubview(buttonScrollToBottom)
                }

                var frame = buttonScrollToBottom.frame
                frame.origin.x = collectionView.frame.width - buttonScrollToBottomSize - view.layoutMargins.right
                frame.origin.y = collectionView.frame.origin.y + collectionView.frame.height - buttonScrollToBottomSize - collectionView.layoutMargins.bottom - composerView.frame.height

                animates({
                    self.buttonScrollToBottom.frame = frame
                    self.buttonScrollToBottom.alpha = 1
                })
            } else {
                var frame = buttonScrollToBottom.frame
                frame.origin.x = collectionView.frame.width - buttonScrollToBottomSize - view.layoutMargins.right
                frame.origin.y = collectionView.frame.origin.y + collectionView.frame.height

                animates({
                    self.buttonScrollToBottom.frame = frame
                    self.buttonScrollToBottom.alpha = 0
                })
            }
        }
    }

    lazy var screenSize = view.frame.size

    override func viewDidLoad() {
        super.viewDidLoad()

        ThemeManager.addObserver(self)
        composerView.delegate = self

        collectionView.register(BasicMessageCell.nib, forCellWithReuseIdentifier: BasicMessageCell.identifier)
