I am new to SwiftUI and I have been wanting to change the color of my system images in my Group for my tab bar to be highlighted a different color other than white. I can change the tab bar group to a different color to match my aesthetic but cannot figure out how to change the color of the system image when I am in that tab to be a different highlight color. Any suggestions would be helpful.TabBar that I put to be grayish to show the highlight being white but the tabbar color I want is the beige background and the highlight to be an rust orange
This is what I have for that SwiftUI View
import SwiftUI
struct MainTabView: View {
@State var selectedTab: Int = 0
var body: some View {
TabView(selection: $selectedTab) {
Group {
HomePageView()
.tabItem {
Label("Home", systemImage: "house")
.foregroundColor(Color.theme.accentSlate)
}
.tag(0)
SearchView()
.tabItem {
Label("Search", systemImage: "magnifyingglass")
.foregroundColor(Color.theme.accentSlate)
}
.tag(1)
CameraView()
.tabItem {
Label("Camera", systemImage: "camera")
.foregroundColor(Color.theme.accentSlate)
}
.tag(2)
NotificationsView()
.tabItem {
Label("Notification", systemImage: "bell")
.foregroundColor(Color.theme.accentSlate)
}
.tag(3)
FavoritesView()
.tabItem {
Label("Favorites", systemImage: "heart")
.foregroundColor(Color.theme.accentSlate)
}
.tag(4)
UserProfileView()
.tabItem {
Label("Profile", systemImage: "person")
.foregroundColor(Color.theme.accentSlate)
}
.tag(5)
}
.toolbarBackground(.visible, for: .tabBar)
.toolbarBackground(Color.theme.backgroundCream, for: .tabBar)
.toolbarColorScheme(.dark, for: .tabBar)
}
.accentColor(Color.theme.secondROrange)
}
}
#Preview {
MainTabView()
}
As far as my knowledge goes I have tried using .accentColor(Color.theme.secondROrange) to change the highlight to the orange I want but its still white.
user26426155 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2