{"slug": "palette-navigation-bar", "title": "Palette navigation bar", "summary": "The article provides a Swift code extension for `UINavigationBar` that applies a custom theme using a `Palette` class. The `setTheme()` method configures the navigation bar's background, tint, and title text colors, and optionally enables large titles on iOS 11 and later.", "body_md": "gistfile1.txt\n\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      \nLearn more about bidirectional Unicode characters\n\n \n    Show hidden characters\n\nextension UINavigationBar {\n\n    func setTheme() {\n\n        barTintColor        = Palette.secondaryBackgroundColor\n\n        tintColor           = Palette.accentColor\n\n        titleTextAttributes = [NSAttributedStringKey.foregroundColor: Palette.accentColor, NSAttributedStringKey.font: UIFont.systemFont(ofSize: 20.0)]\n\n \n\n        if #available(iOS 11.0, *) {\n\n            largeTitleTextAttributes = [NSAttributedStringKey.foregroundColor: Palette.accentColor]\n\n            prefersLargeTitles = true\n\n        }\n\n    }\n\n}", "url": "https://wpnews.pro/news/palette-navigation-bar", "canonical_source": "https://gist.github.com/Awalz/a42da7e3a273600a8461e64e929c906c", "published_at": "2017-09-16 19:07:00+00:00", "updated_at": "2026-05-22 18:09:03.845615+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["UINavigationBar", "Palette"], "alternates": {"html": "https://wpnews.pro/news/palette-navigation-bar", "markdown": "https://wpnews.pro/news/palette-navigation-bar.md", "text": "https://wpnews.pro/news/palette-navigation-bar.txt", "jsonld": "https://wpnews.pro/news/palette-navigation-bar.jsonld"}}