cd /news/developer-tools/palette-navigation-bar · home topics developer-tools article
[ARTICLE · art-9688] src=gist.github.com ↗ pub= topic=developer-tools verified=true sentiment=· neutral

Palette navigation bar

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.

read1 min views21 publishedSep 16, 2017

gistfile1.txt

  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.

Learn more about bidirectional Unicode characters

Show hidden characters

extension UINavigationBar {

    func setTheme() {

        barTintColor        = Palette.secondaryBackgroundColor

        tintColor           = Palette.accentColor

        titleTextAttributes = [NSAttributedStringKey.foregroundColor: Palette.accentColor, NSAttributedStringKey.font: UIFont.systemFont(ofSize: 20.0)]

 

        if #available(iOS 11.0, *) {

            largeTitleTextAttributes = [NSAttributedStringKey.foregroundColor: Palette.accentColor]

            prefersLargeTitles = true

        }

    }

}
── more in #developer-tools 4 stories · sorted by recency
── more on @uinavigationbar 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/palette-navigation-b…] indexed:0 read:1min 2017-09-16 ·