Swiftpack.co -  haifengkao/SwiftUI-Navigation-Bar-Color as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Change SwiftUI Navigation Bar Color for different View
.package(url: "https://github.com/haifengkao/SwiftUI-Navigation-Bar-Color.git", from: "0.7.0")


Version License Platform

Change SwiftUI NavigationBar background color per screen.



For NavigationBarColor to work, you have to set the NavigationBar's background to be transparent. If you want to change the navigation bar's text color, you have to set it here as well.

import SwiftUINavigationBarColor

NavigationView {
    VStack {
        Text("Hello, world!").padding()
}.navigationTransparentBar(tintColor: .white) // mandatory

After that, we can set the NavigationBar's background for each screen.

VStack {
    Text("Hello, Red!").padding()
}.navigationBarBackground {
    Color.red.shadow(radius: 1) // don't forget the shadow under the opaque navigation bar


To run the example project, clone the repo, and run pod install from the Example directory first.


ios 14


NavigationBarColor is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'NavigationBarColor'


Hai Feng Kao, haifeng@cocoaspice.in


NavigationBarColor is available under the MIT license. See the LICENSE file for more info.


Stars: 9
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.


Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API