diff options
| author | Christian Cleberg <[email protected]> | 2026-04-13 19:06:54 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-13 19:06:54 -0500 |
| commit | a6ad2b9815d72575206bdca860eef9db850cdf1c (patch) | |
| tree | b4d5f27aa1655e5e40bab178550d6e2576d7df8b /Hutch/App/RootView.swift | |
| parent | 02a44d115b3784231cad640e992d9c18a7f67b40 (diff) | |
| download | hutch-a6ad2b9815d72575206bdca860eef9db850cdf1c.tar.gz hutch-a6ad2b9815d72575206bdca860eef9db850cdf1c.tar.bz2 hutch-a6ad2b9815d72575206bdca860eef9db850cdf1c.zip | |
feat(theme): AMOLED true-black rows via themedRow()
Apply listRowBackground(Color.black) per row in AMOLED mode using ThemedRowStyle
and themedRow() across Lists and Forms. Use themedList() for scroll/grouped
backgrounds. Treat segmented and clear list rows with isAMOLED-aware
listRowBackground where Color.clear was required. Removes reliance on UIKit
appearance for list cells on iOS 16+.
Implements: https://todo.sr.ht/~ccleberg/hutch/24
Diffstat (limited to 'Hutch/App/RootView.swift')
| -rw-r--r-- | Hutch/App/RootView.swift | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Hutch/App/RootView.swift b/Hutch/App/RootView.swift index b4cf3bd..ed029bb 100644 --- a/Hutch/App/RootView.swift +++ b/Hutch/App/RootView.swift @@ -4,6 +4,7 @@ import SwiftUI /// full-screen sheet for token entry on first launch. struct RootView: View { @Environment(AppState.self) private var appState + @Environment(\.isAMOLEDTheme) private var isAMOLED @State private var homePath = NavigationPath() @State private var morePath = NavigationPath() @State private var repoPath = NavigationPath() @@ -125,6 +126,7 @@ struct RootView: View { .id(appState.sessionIdentity) .defaultAppStorage(appState.accountDefaults) .modifier(SidebarAdaptableTabStyle()) + .modifier(AMOLEDToolbarStyle(isAMOLED: isAMOLED)) .modifier(TabKeyboardShortcuts(selectedTab: Binding( get: { appState.selectedTab }, set: { appState.selectedTab = $0 } @@ -427,6 +429,25 @@ private struct TabKeyboardShortcuts: ViewModifier { } } +// MARK: - AMOLED Toolbar Styling + +/// Applies true-black backgrounds to the tab bar and navigation bar when the AMOLED theme is active. +private struct AMOLEDToolbarStyle: ViewModifier { + let isAMOLED: Bool + + func body(content: Content) -> some View { + if isAMOLED { + content + .toolbarBackground(Color.black, for: .tabBar) + .toolbarBackground(.visible, for: .tabBar) + .toolbarBackground(Color.black, for: .navigationBar) + .toolbarBackground(.visible, for: .navigationBar) + } else { + content + } + } +} + // MARK: - iPad Sidebar Adaptable /// Applies `.tabViewStyle(.sidebarAdaptable)` on iOS 18+ so the tab bar |
