diff --git a/apps/swift-ios/App/Platform/PlatformIncomingShare.swift b/apps/swift-ios/App/Platform/PlatformIncomingShare.swift index 3493c1d8cb..cf47fe3b76 100644 --- a/apps/swift-ios/App/Platform/PlatformIncomingShare.swift +++ b/apps/swift-ios/App/Platform/PlatformIncomingShare.swift @@ -236,7 +236,7 @@ struct PlatformIncomingShareDestinationSheet: View { .foregroundStyle(.secondary) .lineLimit(3) } - .listRowBackground(Color.black) + .listRowBackground(Color(uiColor: .systemBackground)) } Section("Choose a project") { @@ -272,7 +272,7 @@ struct PlatformIncomingShareDestinationSheet: View { } .buttonStyle(.plain) .disabled(isImporting) - .listRowBackground(Color.black) + .listRowBackground(Color(uiColor: .systemBackground)) } } @@ -284,11 +284,11 @@ struct PlatformIncomingShareDestinationSheet: View { .foregroundStyle(.secondary) } } - .listRowBackground(Color.black) + .listRowBackground(Color(uiColor: .systemBackground)) } } .scrollContentBackground(.hidden) - .background(Color.black) + .background(Color(uiColor: .systemBackground)) .navigationTitle("Start a task") .navigationBarTitleDisplayMode(.inline) .toolbar { @@ -298,8 +298,7 @@ struct PlatformIncomingShareDestinationSheet: View { } } } - .background(Color.black.ignoresSafeArea()) - .preferredColorScheme(.dark) + .background(Color(uiColor: .systemBackground).ignoresSafeArea()) .presentationDetents([.medium, .large]) .presentationDragIndicator(.visible) .interactiveDismissDisabled(isImporting) diff --git a/apps/swift-ios/App/RootView.swift b/apps/swift-ios/App/RootView.swift index 95d18ab6bd..cb2ec784ac 100644 --- a/apps/swift-ios/App/RootView.swift +++ b/apps/swift-ios/App/RootView.swift @@ -12,6 +12,5 @@ struct RootView: View { content .background(T3Colors.background.ignoresSafeArea()) .tint(T3Colors.accent) - .preferredColorScheme(.dark) } } diff --git a/apps/swift-ios/DesignSystem/ProviderIcon.swift b/apps/swift-ios/DesignSystem/ProviderIcon.swift index c04e73e91a..f3334747d2 100644 --- a/apps/swift-ios/DesignSystem/ProviderIcon.swift +++ b/apps/swift-ios/DesignSystem/ProviderIcon.swift @@ -33,6 +33,13 @@ enum ProviderBrand: String { } return nil } + + var usesTemplateRendering: Bool { + switch self { + case .openAI, .cursor, .grok: true + case .claude, .openCode: false + } + } } /// Displays the same provider artwork used by the web and marketing surfaces. @@ -52,7 +59,8 @@ struct ProviderIcon: View { ) { Image(brand.rawValue) .resizable() - .renderingMode(.original) + .renderingMode(brand.usesTemplateRendering ? .template : .original) + .foregroundStyle(T3Colors.textSecondary) .scaledToFit() } else { Text(fallbackInitial) diff --git a/apps/swift-ios/DesignSystem/T3Theme.swift b/apps/swift-ios/DesignSystem/T3Theme.swift index 326ec2d267..9688e1c86e 100644 --- a/apps/swift-ios/DesignSystem/T3Theme.swift +++ b/apps/swift-ios/DesignSystem/T3Theme.swift @@ -1,24 +1,66 @@ import SwiftUI +import UIKit enum T3Colors { - static let background = Color.black - static let surface = Color(white: 0.055) - static let surfaceRaised = Color(white: 0.09) - static let input = Color(white: 0.075) - static let border = Color.white.opacity(0.09) - static let separator = Color.white.opacity(0.07) - static let ledgerSurface = Color(white: 0.055) - static let ledgerSelected = Color(white: 0.051) + // Keep these values aligned with apps/mobile/global.css. UIKit variants + // let recycled collection and terminal surfaces participate in the same + // system appearance changes as SwiftUI views. + static let uiBackground = adaptive(light: rgb(0xF2F2F7), dark: rgb(0x0A0A0A)) + static let uiTextPrimary = adaptive(light: rgb(0x262626), dark: rgb(0xF5F5F5)) - static let textPrimary = Color.white - static let textSecondary = Color.white.opacity(0.7) - static let textTertiary = Color.white.opacity(0.57) + static let background = Color(uiColor: uiBackground) + static let sheet = color(light: rgb(0xF2F2F7, alpha: 0.98), dark: rgb(0x0E0E0E, alpha: 0.98)) + static let surface = color(light: rgb(0xFFFFFF), dark: rgb(0x171717)) + static let surfaceRaised = color(light: rgb(0xF5F5F5), dark: rgb(0x1C1C1C)) + static let input = color(light: rgb(0xFFFFFF), dark: rgb(0x141414)) + static let border = color(light: rgb(0x000000, alpha: 0.08), dark: rgb(0xFFFFFF, alpha: 0.06)) + static let inputBorder = color( + light: rgb(0x000000, alpha: 0.10), dark: rgb(0xFFFFFF, alpha: 0.08)) + static let separator = color(light: rgb(0x000000, alpha: 0.04), dark: rgb(0xFFFFFF, alpha: 0.03)) + static let subtle = color(light: rgb(0x000000, alpha: 0.04), dark: rgb(0xFFFFFF, alpha: 0.04)) + static let subtleStrong = color( + light: rgb(0x000000, alpha: 0.08), dark: rgb(0xFFFFFF, alpha: 0.08)) + static let shadow = color(light: rgb(0x000000, alpha: 0.18), dark: rgb(0x000000, alpha: 0.32)) + static let ledgerSurface = surface + static let ledgerSelected = surfaceRaised - static let accent = Color(red: 0.04, green: 0.52, blue: 1) - static let statusRunning = Color(red: 0.13, green: 0.83, blue: 0.93) - static let success = Color(red: 0.19, green: 0.82, blue: 0.35) - static let warning = Color(red: 1, green: 0.62, blue: 0.04) - static let danger = Color(red: 1, green: 0.27, blue: 0.23) + static let textPrimary = Color(uiColor: uiTextPrimary) + static let textSecondary = color(light: rgb(0x525252), dark: rgb(0xA3A3A3)) + static let textTertiary = color(light: rgb(0x737373), dark: rgb(0x8E8E93)) + static let placeholder = color(light: rgb(0xA3A3A3), dark: rgb(0x8E8E93)) + + static let primaryAction = color(light: rgb(0x262626), dark: rgb(0xF5F5F5)) + static let primaryActionForeground = color(light: rgb(0xFFFFFF), dark: rgb(0x0A0A0A)) + static let accent = color(light: rgb(0x007AFF), dark: rgb(0x0A84FF)) + static let statusRunning = color(light: rgb(0x0284C7), dark: rgb(0x22D3EE)) + static let statusInput = color(light: rgb(0x4F46E5), dark: rgb(0xA5B4FC)) + static let success = color(light: rgb(0x16A34A), dark: rgb(0x30D158)) + static let warning = color(light: rgb(0xD97706), dark: rgb(0xFF9F0A)) + static let danger = color(light: rgb(0xDC2626), dark: rgb(0xFF453A)) + + static let syntaxKeyword = color(light: rgb(0x7C3AED), dark: rgb(0xC78EFF)) + static let syntaxLiteral = color(light: rgb(0x2563EB), dark: rgb(0x8CC7FF)) + static let syntaxNumber = color(light: rgb(0xB45309), dark: rgb(0xEBAA6B)) + static let syntaxProperty = color(light: rgb(0x0F766E), dark: rgb(0x6BD1C2)) + + private static func color(light: UIColor, dark: UIColor) -> Color { + Color(uiColor: adaptive(light: light, dark: dark)) + } + + private static func adaptive(light: UIColor, dark: UIColor) -> UIColor { + UIColor { traits in + traits.userInterfaceStyle == .dark ? dark : light + } + } + + private static func rgb(_ hex: UInt32, alpha: CGFloat = 1) -> UIColor { + UIColor( + red: CGFloat((hex >> 16) & 0xFF) / 255, + green: CGFloat((hex >> 8) & 0xFF) / 255, + blue: CGFloat(hex & 0xFF) / 255, + alpha: alpha + ) + } } /// The native client uses semantic fonts so every surface follows Dynamic Type. @@ -56,7 +98,7 @@ enum T3Metrics { extension View { func t3NavigationChrome() -> some View { - toolbarBackground(T3Colors.background.opacity(0.97), for: .navigationBar) + toolbarBackground(T3Colors.sheet, for: .navigationBar) .toolbarBackground(.visible, for: .navigationBar) } } diff --git a/apps/swift-ios/Extensions/Share/ShareViewController.swift b/apps/swift-ios/Extensions/Share/ShareViewController.swift index 7d1d7a0389..bca81da38c 100644 --- a/apps/swift-ios/Extensions/Share/ShareViewController.swift +++ b/apps/swift-ios/Extensions/Share/ShareViewController.swift @@ -6,7 +6,7 @@ final class T3ShareViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = .black + view.backgroundColor = .systemBackground let content = T3ShareExtensionView( save: { [weak self] in @@ -28,7 +28,7 @@ final class T3ShareViewController: UIViewController { } ) let hostingController = UIHostingController(rootView: content) - hostingController.view.backgroundColor = .black + hostingController.view.backgroundColor = .systemBackground addChild(hostingController) hostingController.view.translatesAutoresizingMaskIntoConstraints = false view.addSubview(hostingController.view) @@ -66,14 +66,14 @@ struct T3ShareExtensionView: View { Spacer() Text("T3 Code") .font(.system(size: 17, weight: .semibold)) - .foregroundStyle(.white) + .foregroundStyle(.primary) Spacer() Color.clear.frame(width: 52, height: 1) } .padding(.horizontal, 18) .padding(.vertical, 15) - Divider().overlay(.white.opacity(0.1)) + Divider() VStack(spacing: 14) { Image(systemName: phaseSymbol) @@ -82,7 +82,7 @@ struct T3ShareExtensionView: View { .accessibilityHidden(true) Text(title) .font(.system(size: 22, weight: .bold)) - .foregroundStyle(.white) + .foregroundStyle(.primary) .multilineTextAlignment(.center) Text(message) .font(.system(size: 15, weight: .medium)) @@ -97,10 +97,10 @@ struct T3ShareExtensionView: View { Button(action: primaryAction) { Text(primaryTitle) .font(.system(size: 16, weight: .semibold)) - .foregroundStyle(.black) + .foregroundStyle(Color(uiColor: .systemBackground)) .frame(maxWidth: .infinity) .frame(height: 50) - .background(.white, in: RoundedRectangle(cornerRadius: 13)) + .background(Color(uiColor: .label), in: RoundedRectangle(cornerRadius: 13)) } .buttonStyle(.plain) .disabled(isSaving) @@ -108,8 +108,7 @@ struct T3ShareExtensionView: View { .padding(.horizontal, 18) .padding(.bottom, 18) } - .background(Color.black.ignoresSafeArea()) - .preferredColorScheme(.dark) + .background(Color(uiColor: .systemBackground).ignoresSafeArea()) } private var isSaving: Bool { @@ -151,9 +150,9 @@ struct T3ShareExtensionView: View { private var phaseTint: Color { switch phase { - case .saved: Color(red: 0.43, green: 0.91, blue: 0.72) - case .failed: Color(red: 0.99, green: 0.46, blue: 0.46) - default: .white + case .saved: Color(uiColor: .systemGreen) + case .failed: Color(uiColor: .systemRed) + default: Color(uiColor: .label) } } diff --git a/apps/swift-ios/Extensions/Widgets/AgentActivityWidget.swift b/apps/swift-ios/Extensions/Widgets/AgentActivityWidget.swift index e1e5293af5..91d0a82e3f 100644 --- a/apps/swift-ios/Extensions/Widgets/AgentActivityWidget.swift +++ b/apps/swift-ios/Extensions/Widgets/AgentActivityWidget.swift @@ -6,8 +6,8 @@ struct T3TaskLiveActivity: Widget { var body: some WidgetConfiguration { ActivityConfiguration(for: LiveActivityAttributes.self) { context in T3LiveActivityLockScreenView(context: context) - .activityBackgroundTint(.black) - .activitySystemActionForegroundColor(.white) + .activityBackgroundTint(Color(uiColor: .systemBackground)) + .activitySystemActionForegroundColor(Color(uiColor: .label)) .widgetURL(T3ActivityPresentation(state: context.state).deepLinkURL) } dynamicIsland: { context in let presentation = T3ActivityPresentation(state: context.state) @@ -72,7 +72,7 @@ private struct T3LiveActivityLockScreenView: View { HStack(spacing: 8) { Text("T3 Code") .font(.system(size: 14, weight: .bold)) - .foregroundStyle(.white) + .foregroundStyle(.primary) Spacer(minLength: 8) Label(presentation.shortStatus, systemImage: presentation.phase.systemImage) .font(.system(size: 13, weight: .semibold)) @@ -106,7 +106,7 @@ private struct T3LiveActivityRow: View { .frame(width: 14) Text(row.threadTitle) .font(.system(size: 13, weight: .semibold)) - .foregroundStyle(.white) + .foregroundStyle(.primary) .lineLimit(1) Text(row.projectTitle) .font(.system(size: 11, weight: .medium)) @@ -164,15 +164,15 @@ extension T3AgentActivityPhase { var tint: Color { switch self { case .starting, .running: - Color(red: 0.22, green: 0.75, blue: 0.98) + Color(uiColor: .systemBlue) case .waitingForApproval: - Color(red: 0.99, green: 0.78, blue: 0.22) + Color(uiColor: .systemOrange) case .waitingForInput: - Color(red: 0.65, green: 0.69, blue: 0.99) + Color(uiColor: .systemIndigo) case .completed: - Color(red: 0.43, green: 0.91, blue: 0.72) + Color(uiColor: .systemGreen) case .failed: - Color(red: 0.99, green: 0.46, blue: 0.46) + Color(uiColor: .systemRed) case .stale: Color.secondary } diff --git a/apps/swift-ios/Extensions/Widgets/RecentTasksWidget.swift b/apps/swift-ios/Extensions/Widgets/RecentTasksWidget.swift index 82e1795b22..8bcad3c384 100644 --- a/apps/swift-ios/Extensions/Widgets/RecentTasksWidget.swift +++ b/apps/swift-ios/Extensions/Widgets/RecentTasksWidget.swift @@ -29,7 +29,7 @@ struct T3RecentTasksWidget: Widget { var body: some WidgetConfiguration { StaticConfiguration(kind: kind, provider: T3TaskWidgetProvider()) { entry in T3TaskWidgetView(entry: entry) - .containerBackground(.black, for: .widget) + .containerBackground(Color(uiColor: .systemBackground), for: .widget) } .configurationDisplayName("T3 Code Tasks") .description("See active and recent T3 Code tasks at a glance.") @@ -75,7 +75,7 @@ private struct T3TaskWidgetView: View { .lineLimit(1) Text(task.threadTitle) .font(.system(size: 15, weight: .semibold)) - .foregroundStyle(.white) + .foregroundStyle(.primary) .lineLimit(2) Text(task.projectTitle) .font(.system(size: 11, weight: .medium)) @@ -108,7 +108,7 @@ private struct T3TaskWidgetView: View { VStack(alignment: .leading, spacing: 1) { Text(task.threadTitle) .font(.system(size: 13, weight: .semibold)) - .foregroundStyle(.white) + .foregroundStyle(.primary) .lineLimit(1) Text(task.projectTitle) .font(.system(size: 10, weight: .medium)) @@ -123,7 +123,7 @@ private struct T3TaskWidgetView: View { } } if index < min(orderedTasks.count, 3) - 1 { - Divider().overlay(.white.opacity(0.1)) + Divider() } } } @@ -152,7 +152,7 @@ private struct T3TaskWidgetView: View { HStack(spacing: 6) { Text("T3") .font(.system(size: 14, weight: .black, design: .rounded)) - .foregroundStyle(.white) + .foregroundStyle(.primary) Text("Code") .font(.system(size: 13, weight: .semibold)) .foregroundStyle(.secondary) @@ -160,7 +160,7 @@ private struct T3TaskWidgetView: View { Link(destination: T3WidgetURLs.newTask) { Image(systemName: "square.and.pencil") .font(.system(size: 13, weight: .semibold)) - .foregroundStyle(.white) + .foregroundStyle(.primary) } .accessibilityLabel("New task") } @@ -170,7 +170,7 @@ private struct T3TaskWidgetView: View { VStack(alignment: .leading, spacing: 4) { Text("Ready for a task") .font(.system(size: 14, weight: .semibold)) - .foregroundStyle(.white) + .foregroundStyle(.primary) Text("Tap to start in T3 Code") .font(.system(size: 11, weight: .medium)) .foregroundStyle(.secondary) diff --git a/apps/swift-ios/Features/Chat/FeatureComposerRequestViews.swift b/apps/swift-ios/Features/Chat/FeatureComposerRequestViews.swift index e7646843a1..9db5127b9b 100644 --- a/apps/swift-ios/Features/Chat/FeatureComposerRequestViews.swift +++ b/apps/swift-ios/Features/Chat/FeatureComposerRequestViews.swift @@ -52,16 +52,16 @@ struct FeatureComposerApprovalPanel: View { } .padding(10) .frame(maxWidth: .infinity, alignment: .leading) - .background(.black.opacity(0.46), in: RoundedRectangle(cornerRadius: 10)) + .background(T3Colors.input, in: RoundedRectangle(cornerRadius: 10)) .overlay { RoundedRectangle(cornerRadius: 10) - .stroke(Color.white.opacity(0.08), lineWidth: 1) + .stroke(T3Colors.border, lineWidth: 1) } .padding(.top, 9) } .padding(.horizontal, 15) .padding(.vertical, 12) - .background(Color.white.opacity(0.024)) + .background(T3Colors.subtle) Divider().overlay(T3Colors.separator) @@ -76,7 +76,8 @@ struct FeatureComposerApprovalPanel: View { approvalButton( "Always allow", background: Color.clear, - border: Color.white.opacity(0.14), + border: T3Colors.border, + foreground: T3Colors.textPrimary, action: { onDecision(.allowForSession) } ) } @@ -107,12 +108,13 @@ struct FeatureComposerApprovalPanel: View { _ title: String, background: Color, border: Color = .clear, + foreground: Color = .white, action: @escaping () -> Void ) -> some View { Button(action: action) { Text(title) .font(T3Typography.control.weight(.semibold)) - .foregroundStyle(.white) + .foregroundStyle(foreground) .frame(maxWidth: .infinity) .frame(height: T3Metrics.minimumTapTarget) .background(background, in: RoundedRectangle(cornerRadius: 10)) @@ -180,7 +182,7 @@ struct FeatureComposerUserInputPanel: View { .padding(.horizontal, 15) .padding(.vertical, 12) .frame(maxWidth: .infinity, alignment: .leading) - .background(Color.white.opacity(0.024)) + .background(T3Colors.subtle) Divider().overlay(T3Colors.separator) @@ -216,12 +218,12 @@ struct FeatureComposerUserInputPanel: View { .padding(.horizontal, 12) .frame(minHeight: T3Metrics.minimumTapTarget) .background( - Color.white.opacity(0.025), + T3Colors.input, in: RoundedRectangle(cornerRadius: 11) ) .overlay { RoundedRectangle(cornerRadius: 11) - .stroke(Color.white.opacity(0.09), lineWidth: 1) + .stroke(T3Colors.inputBorder, lineWidth: 1) } .padding(.horizontal, 10) .padding(.top, 7) @@ -319,7 +321,7 @@ struct FeatureComposerUserInputPanel: View { VStack(alignment: .leading, spacing: 2) { Text(option.label) .font(T3Typography.control) - .foregroundStyle(Color.white.opacity(0.9)) + .foregroundStyle(T3Colors.textPrimary) if !option.detail.isEmpty, option.detail != option.label { Text(option.detail) @@ -342,7 +344,7 @@ struct FeatureComposerUserInputPanel: View { .frame(width: 20, height: 20) .overlay { RoundedRectangle(cornerRadius: 5) - .stroke(Color.white.opacity(0.14), lineWidth: 1) + .stroke(T3Colors.border, lineWidth: 1) } } } @@ -350,7 +352,7 @@ struct FeatureComposerUserInputPanel: View { .padding(.vertical, 9) .frame(maxWidth: .infinity, minHeight: T3Metrics.minimumTapTarget, alignment: .leading) .background( - isSelected ? T3Colors.accent.opacity(0.12) : Color.white.opacity(0.045), + isSelected ? T3Colors.accent.opacity(0.12) : T3Colors.subtle, in: RoundedRectangle(cornerRadius: 10) ) .overlay { diff --git a/apps/swift-ios/Features/Chat/FeatureComposerView.swift b/apps/swift-ios/Features/Chat/FeatureComposerView.swift index 7a86fde2ec..698936a26a 100644 --- a/apps/swift-ios/Features/Chat/FeatureComposerView.swift +++ b/apps/swift-ios/Features/Chat/FeatureComposerView.swift @@ -91,7 +91,11 @@ struct FeatureComposerView: View { .padding(.bottom, 10) .background { LinearGradient( - colors: [.clear, .black.opacity(0.94), .black], + colors: [ + .clear, + T3Colors.background.opacity(0.94), + T3Colors.background, + ], startPoint: .top, endPoint: .bottom ) @@ -137,10 +141,10 @@ struct FeatureComposerView: View { collapsedComposer } } - .background(Color(white: 0.052).opacity(0.98), in: composerShape) + .background(T3Colors.input.opacity(0.98), in: composerShape) .overlay { composerShape - .stroke(Color.white.opacity(0.105), lineWidth: 1) + .stroke(T3Colors.inputBorder, lineWidth: 1) } .clipShape(composerShape) } @@ -479,7 +483,7 @@ private struct FeatureContextMeter: View { var body: some View { ZStack { Circle() - .stroke(Color.white.opacity(0.13), lineWidth: 2) + .stroke(T3Colors.border, lineWidth: 2) Circle() .trim(from: 0, to: clampedUsage) .stroke( diff --git a/apps/swift-ios/Features/Chat/ThreadDetailView.swift b/apps/swift-ios/Features/Chat/ThreadDetailView.swift index f7d4e0f09b..c5dcd4dad3 100644 --- a/apps/swift-ios/Features/Chat/ThreadDetailView.swift +++ b/apps/swift-ios/Features/Chat/ThreadDetailView.swift @@ -52,7 +52,7 @@ public struct ThreadDetailView: View { ) } } - .background(Color.black) + .background(T3Colors.background) .navigationBarTitleDisplayMode(.inline) .navigationBarBackButtonHidden(false) .t3NavigationChrome() @@ -298,9 +298,9 @@ public struct ThreadDetailView: View { switch currentThread.homeStatus { case .working: T3Colors.statusRunning case .approval: T3Colors.warning - case .input: Color(red: 0.65, green: 0.71, blue: 0.99) + case .input: T3Colors.statusInput case .failed: T3Colors.danger - case .done: Color(red: 0.43, green: 0.91, blue: 0.72) + case .done: T3Colors.success case .ready: T3Colors.textTertiary } } @@ -627,7 +627,7 @@ private struct FeatureTranscriptCollectionView: UIViewRepresentable { frame: .zero, collectionViewLayout: Self.makeLayout() ) - collectionView.backgroundColor = .black + collectionView.backgroundColor = T3Colors.uiBackground collectionView.alwaysBounceVertical = true collectionView.keyboardDismissMode = .onDrag collectionView.delaysContentTouches = false @@ -1446,7 +1446,7 @@ struct FeatureMessageView: View { .padding(.vertical, 11) .frame(maxWidth: T3Metrics.readingWidth * 0.88, alignment: .leading) .background( - Color.white.opacity(0.09), + T3Colors.subtleStrong, in: UnevenRoundedRectangle( topLeadingRadius: 16, bottomLeadingRadius: 16, diff --git a/apps/swift-ios/Features/Connection/ConnectionOnboardingView.swift b/apps/swift-ios/Features/Connection/ConnectionOnboardingView.swift index 63fb303a37..6fc8ce2137 100644 --- a/apps/swift-ios/Features/Connection/ConnectionOnboardingView.swift +++ b/apps/swift-ios/Features/Connection/ConnectionOnboardingView.swift @@ -58,10 +58,9 @@ public struct ConnectionOnboardingView: View { } } .frame(maxWidth: .infinity, maxHeight: .infinity) - .background(Color.black) + .background(T3Colors.background) .animation(.snappy(duration: 0.24), value: stage) } - .preferredColorScheme(.dark) .toolbar { if stage == .welcome, let onCancel { ToolbarItem(placement: .cancellationAction) { @@ -156,7 +155,7 @@ public struct ConnectionOnboardingView: View { showingScanner = true } - Divider().overlay(Color.white.opacity(0.09)) + Divider().overlay(T3Colors.border) connectionAction( title: "Paste connection link", @@ -166,7 +165,7 @@ public struct ConnectionOnboardingView: View { pasteConnectionLink() } - Divider().overlay(Color.white.opacity(0.09)) + Divider().overlay(T3Colors.border) connectionAction( title: "Enter details manually", @@ -235,7 +234,7 @@ public struct ConnectionOnboardingView: View { .accessibilityHint("Reconnects to this server") if environment.id != model.snapshot.environments.last?.id { - Divider().overlay(Color.white.opacity(0.09)) + Divider().overlay(T3Colors.border) } } } @@ -629,10 +628,10 @@ private extension View { .font(.body.monospaced()) .padding(.horizontal, 14) .frame(minHeight: 50) - .background(Color.white.opacity(0.07)) + .background(T3Colors.input) .overlay(alignment: .bottom) { Rectangle() - .fill(Color.white.opacity(0.18)) + .fill(T3Colors.inputBorder) .frame(height: 1) } } @@ -642,10 +641,14 @@ private struct ConnectionPrimaryButtonStyle: ButtonStyle { func makeBody(configuration: Configuration) -> some View { configuration.label .font(.body.weight(.semibold)) - .foregroundStyle(.black) + .foregroundStyle(T3Colors.primaryActionForeground) .padding(.horizontal, 16) .frame(minHeight: 52) - .background(configuration.isPressed ? Color.white.opacity(0.76) : .white) + .background( + configuration.isPressed + ? T3Colors.primaryAction.opacity(0.76) + : T3Colors.primaryAction + ) .clipShape(RoundedRectangle(cornerRadius: 12)) } } diff --git a/apps/swift-ios/Features/Connection/T3ConnectView.swift b/apps/swift-ios/Features/Connection/T3ConnectView.swift index fdb1bc77f2..910bf5df97 100644 --- a/apps/swift-ios/Features/Connection/T3ConnectView.swift +++ b/apps/swift-ios/Features/Connection/T3ConnectView.swift @@ -65,7 +65,6 @@ public struct T3ConnectView: View { } message: { Text(controller.errorMessage ?? "Something went wrong.") } - .preferredColorScheme(.dark) } @ViewBuilder @@ -81,9 +80,9 @@ public struct T3ConnectView: View { } } else { ZStack { - Color.black.ignoresSafeArea() + T3Colors.background.ignoresSafeArea() ProgressView() - .tint(.white) + .tint(T3Colors.textPrimary) } } } @@ -96,7 +95,7 @@ public struct T3ConnectView: View { } .listStyle(.plain) .scrollContentBackground(.hidden) - .background(Color.black) + .background(T3Colors.background) } @ViewBuilder @@ -112,12 +111,11 @@ public struct T3ConnectView: View { } .environment(\.clerkTheme, T3ConnectClerkAppearance.theme) .environment(clerk) - .preferredColorScheme(.dark) } else { ZStack { - Color.black.ignoresSafeArea() + T3Colors.background.ignoresSafeArea() ProgressView() - .tint(.white) + .tint(T3Colors.textPrimary) } } } @@ -150,7 +148,7 @@ public struct T3ConnectView: View { .foregroundStyle(T3Colors.textTertiary) } .padding(.vertical, 8) - .listRowBackground(Color.black) + .listRowBackground(T3Colors.background) } } @@ -169,7 +167,7 @@ public struct T3ConnectView: View { } } .padding(.vertical, 3) - .listRowBackground(Color.black) + .listRowBackground(T3Colors.background) } } @@ -184,12 +182,12 @@ public struct T3ConnectView: View { .foregroundStyle(T3Colors.textSecondary) } .padding(.vertical, 8) - .listRowBackground(Color.black) + .listRowBackground(T3Colors.background) } ForEach(controller.environments) { item in environmentRow(item) - .listRowBackground(Color.black) + .listRowBackground(T3Colors.background) .swipeActions { Button(role: .destructive) { Task { await controller.unlink(item.environment) } @@ -206,7 +204,7 @@ public struct T3ConnectView: View { .font(T3Typography.supporting) .foregroundStyle(T3Colors.textSecondary) } - .listRowBackground(Color.black) + .listRowBackground(T3Colors.background) } } } @@ -221,7 +219,7 @@ public struct T3ConnectView: View { VStack(alignment: .leading, spacing: 3) { Text(item.environment.label) .font(T3Typography.homeTitle) - .foregroundStyle(.white) + .foregroundStyle(T3Colors.textPrimary) .lineLimit(1) Text(statusText(item)) .font(T3Typography.supporting) @@ -355,7 +353,6 @@ private struct T3ConnectAuthenticationView: View { .prefetchClerkImages() .environment(\.clerkTheme, T3ConnectClerkAppearance.theme) .environment(clerk) - .preferredColorScheme(.dark) } .alert( "Couldn’t sign in", @@ -374,9 +371,9 @@ private struct T3ConnectAuthenticationView: View { HStack(spacing: 10) { Text("T3") .font(.system(size: 14, weight: .heavy, design: .rounded)) - .foregroundStyle(.black) + .foregroundStyle(T3Colors.primaryActionForeground) .frame(width: 32, height: 32) - .background(.white) + .background(T3Colors.primaryAction) .clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous)) Text("T3 Connect") @@ -391,7 +388,7 @@ private struct T3ConnectAuthenticationView: View { if clerk.environment == nil { HStack(spacing: 10) { ProgressView() - .tint(.white) + .tint(T3Colors.textPrimary) Text("Loading sign-in options…") .font(T3Typography.control) .foregroundStyle(T3Colors.textSecondary) @@ -531,7 +528,7 @@ private struct T3ConnectAuthProviderIcon: View { private enum T3ConnectClerkAppearance { static let theme = ClerkTheme( colors: .init( - primary: .white, + primary: T3Colors.primaryAction, background: T3Colors.background, input: T3Colors.input, danger: T3Colors.danger, @@ -539,12 +536,12 @@ private enum T3ConnectClerkAppearance { warning: T3Colors.warning, foreground: T3Colors.textPrimary, mutedForeground: T3Colors.textSecondary, - primaryForeground: .black, + primaryForeground: T3Colors.primaryActionForeground, inputForeground: T3Colors.textPrimary, - neutral: .white, - ring: .white, + neutral: T3Colors.textPrimary, + ring: T3Colors.textPrimary, muted: T3Colors.surfaceRaised, - shadow: .black, + shadow: T3Colors.border, border: T3Colors.border ), design: .init(borderRadius: 12) diff --git a/apps/swift-ios/Features/Devices/DevicesView.swift b/apps/swift-ios/Features/Devices/DevicesView.swift index 3684cc6579..58403b2b29 100644 --- a/apps/swift-ios/Features/Devices/DevicesView.swift +++ b/apps/swift-ios/Features/Devices/DevicesView.swift @@ -45,7 +45,7 @@ public struct DevicesView: View { } } .frame(maxWidth: .infinity, maxHeight: .infinity) - .background(Color.black) + .background(T3Colors.background) .navigationTitle("Devices") .navigationBarTitleDisplayMode(.inline) .toolbar { @@ -143,7 +143,7 @@ public struct DevicesView: View { } .listStyle(.plain) .scrollContentBackground(.hidden) - .background(Color.black) + .background(T3Colors.background) .refreshable { await reload() } diff --git a/apps/swift-ios/Features/Files/FeatureFilesView.swift b/apps/swift-ios/Features/Files/FeatureFilesView.swift index 9b95543b03..dc7823c7a7 100644 --- a/apps/swift-ios/Features/Files/FeatureFilesView.swift +++ b/apps/swift-ios/Features/Files/FeatureFilesView.swift @@ -13,7 +13,7 @@ public struct FeatureFilesView: View { public var body: some View { FeatureFileDirectoryView(client: client, threadID: threadID, path: nil, title: "Files") - .background(Color.black) + .background(T3Colors.background) } } @@ -59,7 +59,7 @@ private struct FeatureFileDirectoryView: View { .refreshable { await load() } } } - .background(Color.black) + .background(T3Colors.background) .navigationTitle(title) .navigationBarTitleDisplayMode(.inline) .searchable(text: $searchText, prompt: "Filter files") @@ -208,7 +208,7 @@ private struct FeatureFilePreviewView: View { ) } } - .background(Color.black) + .background(T3Colors.background) .navigationTitle(entry.name) .navigationBarTitleDisplayMode(.inline) .toolbar { @@ -332,7 +332,7 @@ private struct FeatureSourceTextView: View { .textSelection(.enabled) } } - .background(Color.black) + .background(T3Colors.background) .accessibilityLabel("Source file") } } @@ -356,10 +356,10 @@ private struct FeatureHighlightedSourceLine: View { switch kind { case .plain: T3Colors.textPrimary.opacity(0.92) case .comment: T3Colors.textTertiary - case .keyword: Color(red: 0.78, green: 0.56, blue: 1) - case .literal: Color(red: 0.55, green: 0.78, blue: 1) - case .number: Color(red: 0.92, green: 0.67, blue: 0.42) - case .property: Color(red: 0.42, green: 0.82, blue: 0.76) + case .keyword: T3Colors.syntaxKeyword + case .literal: T3Colors.syntaxLiteral + case .number: T3Colors.syntaxNumber + case .property: T3Colors.syntaxProperty } } } diff --git a/apps/swift-ios/Features/Review/FeatureReviewView.swift b/apps/swift-ios/Features/Review/FeatureReviewView.swift index a2ab122ce1..4492196158 100644 --- a/apps/swift-ios/Features/Review/FeatureReviewView.swift +++ b/apps/swift-ios/Features/Review/FeatureReviewView.swift @@ -30,7 +30,7 @@ public struct FeatureReviewView: View { ) } } - .background(Color.black) + .background(T3Colors.background) .navigationTitle("Review") .navigationBarTitleDisplayMode(.inline) .toolbar { @@ -239,7 +239,7 @@ private struct FeatureDiffView: View { } } } - .background(Color.black) + .background(T3Colors.background) .navigationTitle(file.path.split(separator: "/").last.map(String.init) ?? file.path) .navigationBarTitleDisplayMode(.inline) .toolbar { diff --git a/apps/swift-ios/Features/Root/FeatureRootView.swift b/apps/swift-ios/Features/Root/FeatureRootView.swift index 6019b62cd2..924cf486fc 100644 --- a/apps/swift-ios/Features/Root/FeatureRootView.swift +++ b/apps/swift-ios/Features/Root/FeatureRootView.swift @@ -41,9 +41,9 @@ public struct FeatureRootView: View { ConnectionOnboardingView(model: model) } } - .preferredColorScheme(model.snapshot.settings.appearance == .dark ? .dark : nil) - .tint(.white) - .background(Color.black.ignoresSafeArea()) + .preferredColorScheme(preferredColorScheme) + .tint(T3Colors.accent) + .background(T3Colors.background.ignoresSafeArea()) .task { await model.start() } .alert( "Something went wrong", @@ -69,6 +69,14 @@ public struct FeatureRootView: View { isManagingConnections: model.isManagingConnections ) } + + private var preferredColorScheme: ColorScheme? { + switch model.snapshot.settings.appearance { + case .system: nil + case .light: .light + case .dark: .dark + } + } } enum FeatureRootPresentation { @@ -96,7 +104,7 @@ private struct FeatureLoadingView: View { .foregroundStyle(T3Colors.textSecondary) } .frame(maxWidth: .infinity, maxHeight: .infinity) - .background(Color.black) + .background(T3Colors.background) .accessibilityElement(children: .combine) } } diff --git a/apps/swift-ios/Features/Settings/SettingsView.swift b/apps/swift-ios/Features/Settings/SettingsView.swift index c62f4b66f9..97430f7db6 100644 --- a/apps/swift-ios/Features/Settings/SettingsView.swift +++ b/apps/swift-ios/Features/Settings/SettingsView.swift @@ -25,7 +25,7 @@ public struct SettingsView: View { aboutSection } .scrollContentBackground(.hidden) - .background(Color.black) + .background(T3Colors.background) .navigationTitle("Settings") .navigationBarTitleDisplayMode(.inline) .toolbar { @@ -229,6 +229,7 @@ public struct SettingsView: View { Section("Preferences") { Picker("Theme", selection: $settings.appearance) { Text("System").tag(FeatureAppearance.system) + Text("Light").tag(FeatureAppearance.light) Text("Dark").tag(FeatureAppearance.dark) } Toggle("Haptics", isOn: $settings.hapticsEnabled) diff --git a/apps/swift-ios/Features/Shared/FeatureModels.swift b/apps/swift-ios/Features/Shared/FeatureModels.swift index d56c49cdaf..eef9b954ad 100644 --- a/apps/swift-ios/Features/Shared/FeatureModels.swift +++ b/apps/swift-ios/Features/Shared/FeatureModels.swift @@ -701,6 +701,7 @@ public struct FeatureSelection: Sendable, Equatable, Hashable, Codable { public enum FeatureAppearance: String, CaseIterable, Sendable, Codable { case system + case light case dark } @@ -712,7 +713,7 @@ public struct FeatureSettings: Sendable, Equatable, Codable { public var defaultSelection: FeatureSelection? public init( - appearance: FeatureAppearance = .dark, + appearance: FeatureAppearance = .system, hapticsEnabled: Bool = true, notificationsEnabled: Bool = true, liveActivitiesEnabled: Bool = true, @@ -738,7 +739,7 @@ public struct FeatureSettings: Sendable, Equatable, Codable { appearance = try container.decodeIfPresent( FeatureAppearance.self, forKey: .appearance - ) ?? .dark + ) ?? .system hapticsEnabled = try container.decodeIfPresent( Bool.self, forKey: .hapticsEnabled diff --git a/apps/swift-ios/Features/SourceControl/FeatureSourceControlView.swift b/apps/swift-ios/Features/SourceControl/FeatureSourceControlView.swift index 77758bdac9..d217cf40db 100644 --- a/apps/swift-ios/Features/SourceControl/FeatureSourceControlView.swift +++ b/apps/swift-ios/Features/SourceControl/FeatureSourceControlView.swift @@ -36,7 +36,7 @@ public struct FeatureSourceControlView: View { ) } } - .background(Color.black) + .background(T3Colors.background) .navigationTitle("Source Control") .navigationBarTitleDisplayMode(.inline) .toolbar { diff --git a/apps/swift-ios/Features/Terminal/FeatureTerminalView.swift b/apps/swift-ios/Features/Terminal/FeatureTerminalView.swift index cf50e168c5..066e82065b 100644 --- a/apps/swift-ios/Features/Terminal/FeatureTerminalView.swift +++ b/apps/swift-ios/Features/Terminal/FeatureTerminalView.swift @@ -80,7 +80,7 @@ public struct FeatureTerminalView: View { public var body: some View { ZStack { - Color.black + T3Colors.background GhosttyTerminalSurface( terminalKey: "\(threadID):\(activeTerminalID)", @@ -106,15 +106,15 @@ public struct FeatureTerminalView: View { if isLoading, terminal == nil { ProgressView("Opening terminal…") - .tint(.white) - .foregroundStyle(.white) + .tint(T3Colors.textPrimary) + .foregroundStyle(T3Colors.textPrimary) } else if let errorMessage, terminal == nil { ContentUnavailableView( "Terminal unavailable", systemImage: "terminal", description: Text(errorMessage) ) - .foregroundStyle(.white) + .foregroundStyle(T3Colors.textPrimary) } if let errorMessage, terminal != nil { @@ -133,7 +133,7 @@ public struct FeatureTerminalView: View { terminalHeader } - .background(Color.black.ignoresSafeArea()) + .background(T3Colors.background.ignoresSafeArea()) .toolbar(.hidden, for: .navigationBar) .task { for await updates in client.terminalSessions(threadID: threadID) { @@ -186,7 +186,7 @@ public struct FeatureTerminalView: View { ZStack { Text("Terminal") .font(T3Typography.navigationTitle) - .foregroundStyle(.white) + .foregroundStyle(T3Colors.textPrimary) HStack { Button { @@ -195,7 +195,7 @@ public struct FeatureTerminalView: View { Image(systemName: "xmark") .frame(width: 44, height: 44) } - .foregroundStyle(.white) + .foregroundStyle(T3Colors.textPrimary) .accessibilityLabel("Close terminal") Spacer() @@ -205,7 +205,7 @@ public struct FeatureTerminalView: View { } } .frame(height: 48) - .background(Color.black) + .background(T3Colors.background) Spacer(minLength: 0) } diff --git a/apps/swift-ios/Features/Terminal/TerminalSurfaceView.swift b/apps/swift-ios/Features/Terminal/TerminalSurfaceView.swift index 3cc110e42f..4741a71989 100644 --- a/apps/swift-ios/Features/Terminal/TerminalSurfaceView.swift +++ b/apps/swift-ios/Features/Terminal/TerminalSurfaceView.swift @@ -4,6 +4,7 @@ import SwiftUI import UIKit struct GhosttyTerminalSurface: UIViewRepresentable { + @SwiftUI.Environment(\.colorScheme) private var colorScheme let terminalKey: String let buffer: String let fontSize: CGFloat @@ -25,6 +26,7 @@ struct GhosttyTerminalSurface: UIViewRepresentable { } private func configure(_ view: GhosttyTerminalView) { + view.isDarkMode = colorScheme == .dark view.onInput = onInput view.onResize = onResize view.onClear = onClear @@ -296,12 +298,13 @@ private final class TerminalAccessoryView: UIInputView { private let stackView = UIStackView() private let dismissButton = TerminalAccessoryButton(action: .dismiss) private var actionButtons = [TerminalAccessoryAction: TerminalAccessoryButton]() + private var activeModifier: TerminalAccessoryAction? var onAction: ((TerminalAccessoryAction) -> Void)? init() { super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 50), inputViewStyle: .keyboard) allowsSelfSizing = true - backgroundColor = .black + backgroundColor = T3Colors.uiBackground scrollView.showsHorizontalScrollIndicator = false scrollView.alwaysBounceHorizontal = true @@ -326,11 +329,6 @@ private final class TerminalAccessoryView: UIInputView { stackView.addArrangedSubview(button) } - var dismissConfiguration = UIButton.Configuration.plain() - dismissConfiguration.image = UIImage(systemName: "keyboard.chevron.compact.down") - dismissConfiguration.baseForegroundColor = UIColor(white: 0.82, alpha: 1) - dismissConfiguration.contentInsets = .zero - dismissButton.configuration = dismissConfiguration dismissButton.accessibilityLabel = "Dismiss keyboard" dismissButton.addTarget(self, action: #selector(handleButton(_:)), for: .touchUpInside) dismissButton.translatesAutoresizingMaskIntoConstraints = false @@ -351,6 +349,11 @@ private final class TerminalAccessoryView: UIInputView { stackView.bottomAnchor.constraint(equalTo: scrollView.contentLayoutGuide.bottomAnchor), stackView.heightAnchor.constraint(equalTo: scrollView.frameLayoutGuide.heightAnchor), ]) + refreshAppearance() + registerForTraitChanges([UITraitUserInterfaceStyle.self]) { + (self: Self, _: UITraitCollection) in + self.refreshAppearance() + } } @available(*, unavailable) @@ -363,12 +366,26 @@ private final class TerminalAccessoryView: UIInputView { } func setActiveModifier(_ action: TerminalAccessoryAction?) { + activeModifier = action for modifier in [TerminalAccessoryAction.command, .control] { guard let button = actionButtons[modifier] else { continue } applyStyle(to: button, active: modifier == action) } } + func refreshAppearance() { + backgroundColor = T3Colors.uiBackground + for (action, button) in actionButtons { + applyStyle(to: button, active: action == activeModifier) + } + + var dismissConfiguration = UIButton.Configuration.plain() + dismissConfiguration.image = UIImage(systemName: "keyboard.chevron.compact.down") + dismissConfiguration.baseForegroundColor = .secondaryLabel + dismissConfiguration.contentInsets = .zero + dismissButton.configuration = dismissConfiguration + } + private func configure(_ button: TerminalAccessoryButton, label: String) { button.setTitle(label.uppercased(), for: .normal) button.titleLabel?.font = .systemFont(ofSize: 10, weight: .semibold) @@ -386,12 +403,21 @@ private final class TerminalAccessoryView: UIInputView { terminalButton.terminalAction != .dismiss { configuration.title = terminalButton.terminalAction.label.uppercased() } - configuration.baseForegroundColor = active ? .black : UIColor(white: 0.88, alpha: 1) - configuration.background.backgroundColor = active - ? UIColor(white: 0.94, alpha: 1) - : UIColor(white: 0.08, alpha: 1) + let isDark = traitCollection.userInterfaceStyle == .dark + configuration.baseForegroundColor = if active { + isDark ? UIColor(white: 0.04, alpha: 1) : .white + } else { + isDark ? UIColor(white: 0.88, alpha: 1) : T3Colors.uiTextPrimary + } + configuration.background.backgroundColor = if active { + isDark ? UIColor(white: 0.94, alpha: 1) : T3Colors.uiTextPrimary + } else { + isDark ? UIColor(white: 0.08, alpha: 1) : .white + } configuration.background.cornerRadius = 7 - configuration.background.strokeColor = UIColor(white: active ? 0.55 : 0.20, alpha: 1) + configuration.background.strokeColor = isDark + ? UIColor(white: active ? 0.55 : 0.20, alpha: 1) + : UIColor(white: 0, alpha: active ? 0.18 : 0.10) configuration.background.strokeWidth = 1 configuration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { var attributes = $0 @@ -415,11 +441,11 @@ private final class TerminalAccessoryView: UIInputView { final class GhosttyTerminalView: UIView, UITextFieldDelegate, UIContextMenuInteractionDelegate { private static let minimumVerticalScrollStepPoints: CGFloat = 18 private static let verticalScrollStepMultiplier: CGFloat = 1.15 - private static let themeConfig = """ - background = #000000 + private static let darkThemeConfig = """ + background = #0a0a0a foreground = #adadb1 cursor-color = #009fff - cursor-text = #000000 + cursor-text = #0a0a0a cursor-style-blink = false palette = 0=#141415 palette = 1=#ff2e3f @@ -429,14 +455,37 @@ final class GhosttyTerminalView: UIView, UITextFieldDelegate, UIContextMenuInter palette = 5=#c635e4 palette = 6=#08c0ef palette = 7=#c6c6c8 - palette = 8=#55555a + palette = 8=#141415 palette = 9=#ff2e3f palette = 10=#0dbe4e palette = 11=#ffca00 palette = 12=#009fff palette = 13=#c635e4 palette = 14=#08c0ef - palette = 15=#ffffff + palette = 15=#c6c6c8 + """ + private static let lightThemeConfig = """ + background = #f2f2f7 + foreground = #6c6c71 + cursor-color = #009fff + cursor-text = #f2f2f7 + cursor-style-blink = false + palette = 0=#1f1f21 + palette = 1=#ff2e3f + palette = 2=#0dbe4e + palette = 3=#ffca00 + palette = 4=#009fff + palette = 5=#c635e4 + palette = 6=#08c0ef + palette = 7=#c6c6c8 + palette = 8=#1f1f21 + palette = 9=#ff2e3f + palette = 10=#0dbe4e + palette = 11=#ffca00 + palette = 12=#009fff + palette = 13=#c635e4 + palette = 14=#08c0ef + palette = 15=#c6c6c8 """ var onInput: ((String) -> Void)? @@ -444,6 +493,14 @@ final class GhosttyTerminalView: UIView, UITextFieldDelegate, UIContextMenuInter var onClear: (() -> Void)? var onFontSizeStep: ((Int) -> Void)? + var isDarkMode = true { + didSet { + guard oldValue != isDarkMode else { return } + applyChromeAppearance() + refreshSurface() + } + } + var terminalKey = "" { didSet { accessibilityIdentifier = "t3-terminal-\(terminalKey)" @@ -515,12 +572,10 @@ final class GhosttyTerminalView: UIView, UITextFieldDelegate, UIContextMenuInter init() { super.init(frame: .zero) - backgroundColor = .black clipsToBounds = true contentScaleFactor = UIScreen.main.scale accessibilityLabel = "Terminal" - terminalViewport.backgroundColor = .black terminalViewport.clipsToBounds = true terminalViewport.contentScaleFactor = contentScaleFactor terminalViewport.translatesAutoresizingMaskIntoConstraints = false @@ -552,14 +607,6 @@ final class GhosttyTerminalView: UIView, UITextFieldDelegate, UIContextMenuInter inputField.onCopyOutput = { [weak self] in self?.copyOutput() } inputField.onPasteText = { [weak self] in self?.pasteText() } - var keyboardConfiguration = UIButton.Configuration.filled() - keyboardConfiguration.image = UIImage(systemName: "keyboard") - keyboardConfiguration.baseForegroundColor = UIColor(white: 0.88, alpha: 1) - keyboardConfiguration.baseBackgroundColor = UIColor(white: 0.10, alpha: 0.96) - keyboardConfiguration.background.cornerRadius = 24 - keyboardConfiguration.background.strokeColor = UIColor(white: 0.25, alpha: 1) - keyboardConfiguration.background.strokeWidth = 1 - keyboardButton.configuration = keyboardConfiguration keyboardButton.accessibilityLabel = "Show keyboard" keyboardButton.isHidden = true keyboardButton.translatesAutoresizingMaskIntoConstraints = false @@ -597,6 +644,7 @@ final class GhosttyTerminalView: UIView, UITextFieldDelegate, UIContextMenuInter keyboardButton.widthAnchor.constraint(equalToConstant: 48), keyboardButton.heightAnchor.constraint(equalToConstant: 48), ]) + applyChromeAppearance() } @available(*, unavailable) @@ -718,8 +766,12 @@ final class GhosttyTerminalView: UIView, UITextFieldDelegate, UIContextMenuInter app = createdApp surface = createdSurface - ghostty_app_set_color_scheme(createdApp, GHOSTTY_COLOR_SCHEME_DARK) - ghostty_surface_set_color_scheme(createdSurface, GHOSTTY_COLOR_SCHEME_DARK) + let ghosttyColorScheme = + isDarkMode + ? GHOSTTY_COLOR_SCHEME_DARK + : GHOSTTY_COLOR_SCHEME_LIGHT + ghostty_app_set_color_scheme(createdApp, ghosttyColorScheme) + ghostty_surface_set_color_scheme(createdSurface, ghosttyColorScheme) setupWriteCallback() resizeSurface() feedBuffer(buffer) @@ -735,6 +787,30 @@ final class GhosttyTerminalView: UIView, UITextFieldDelegate, UIContextMenuInter setNeedsLayout() } + private func applyChromeAppearance() { + let background = + isDarkMode + ? UIColor(red: 10 / 255, green: 10 / 255, blue: 10 / 255, alpha: 1) + : UIColor(red: 242 / 255, green: 242 / 255, blue: 247 / 255, alpha: 1) + backgroundColor = background + terminalViewport.backgroundColor = background + accessoryView.overrideUserInterfaceStyle = isDarkMode ? .dark : .light + accessoryView.refreshAppearance() + + var keyboardConfiguration = UIButton.Configuration.filled() + keyboardConfiguration.image = UIImage(systemName: "keyboard") + keyboardConfiguration.baseForegroundColor = isDarkMode ? .white : T3Colors.uiTextPrimary + keyboardConfiguration.baseBackgroundColor = + isDarkMode ? UIColor(white: 0.10, alpha: 0.96) : .white + keyboardConfiguration.background.cornerRadius = 24 + keyboardConfiguration.background.strokeColor = + isDarkMode + ? UIColor(white: 0.25, alpha: 1) + : UIColor(white: 0, alpha: 0.10) + keyboardConfiguration.background.strokeWidth = 1 + keyboardButton.configuration = keyboardConfiguration + } + private func refreshSurface() { resetSurface() createSurfaceIfPossible() @@ -922,8 +998,9 @@ final class GhosttyTerminalView: UIView, UITextFieldDelegate, UIContextMenuInter let url = FileManager.default.temporaryDirectory .appendingPathComponent("t3-swiftui-terminal.ghostty") do { - if (try? String(contentsOf: url, encoding: .utf8)) != Self.themeConfig { - try Self.themeConfig.write(to: url, atomically: true, encoding: .utf8) + let themeConfig = isDarkMode ? Self.darkThemeConfig : Self.lightThemeConfig + if (try? String(contentsOf: url, encoding: .utf8)) != themeConfig { + try themeConfig.write(to: url, atomically: true, encoding: .utf8) } url.path.withCString { ghostty_config_load_file(config, $0) } } catch { diff --git a/apps/swift-ios/Features/Workspace/HomeThreadCollectionView.swift b/apps/swift-ios/Features/Workspace/HomeThreadCollectionView.swift index 0e7d1e8698..eabf9ef3cc 100644 --- a/apps/swift-ios/Features/Workspace/HomeThreadCollectionView.swift +++ b/apps/swift-ios/Features/Workspace/HomeThreadCollectionView.swift @@ -30,7 +30,7 @@ struct HomeThreadCollectionView: UIViewRepresentable { func makeUIView(context: Context) -> UICollectionView { var configuration = UICollectionLayoutListConfiguration(appearance: .plain) - configuration.backgroundColor = .black + configuration.backgroundColor = T3Colors.uiBackground configuration.showsSeparators = false configuration.headerMode = .none configuration.footerMode = .none @@ -42,7 +42,7 @@ struct HomeThreadCollectionView: UIViewRepresentable { frame: .zero, collectionViewLayout: UICollectionViewCompositionalLayout.list(using: configuration) ) - collectionView.backgroundColor = .black + collectionView.backgroundColor = T3Colors.uiBackground collectionView.alwaysBounceVertical = true collectionView.keyboardDismissMode = .interactive collectionView.contentInset = UIEdgeInsets(top: 4, left: 0, bottom: 74, right: 0) @@ -252,7 +252,7 @@ struct HomeThreadCollectionView: UIViewRepresentable { cell.backgroundConfiguration = UIBackgroundConfiguration.clear() cell.accessories = [] - cell.tintColor = .white + cell.tintColor = T3Colors.uiTextPrimary cell.contentView.accessibilityElementsHidden = true configureAccessibility(cell, item: item) } diff --git a/apps/swift-ios/Features/Workspace/NewThreadView.swift b/apps/swift-ios/Features/Workspace/NewThreadView.swift index d3816b51ee..6bb6f88b93 100644 --- a/apps/swift-ios/Features/Workspace/NewThreadView.swift +++ b/apps/swift-ios/Features/Workspace/NewThreadView.swift @@ -135,7 +135,6 @@ public struct NewThreadView: View { .interactiveDismissDisabled(isSubmitting) .presentationDetents([.large]) .presentationDragIndicator(.visible) - .preferredColorScheme(.dark) } private var topBar: some View { @@ -247,8 +246,8 @@ public struct NewThreadView: View { } } .buttonStyle(.borderedProminent) - .tint(.white) - .foregroundStyle(.black) + .tint(T3Colors.primaryAction) + .foregroundStyle(T3Colors.primaryActionForeground) .padding(.top, 6) } .padding(.horizontal, 28) @@ -943,7 +942,6 @@ private struct NewTaskBranchPicker: View { } .presentationDetents([.medium, .large]) .presentationBackground(T3Colors.background) - .preferredColorScheme(.dark) } private var filteredBranches: [FeatureWorkspaceBranch] { diff --git a/apps/swift-ios/Features/Workspace/ProjectAndArchiveViews.swift b/apps/swift-ios/Features/Workspace/ProjectAndArchiveViews.swift index 90e1036e93..f393243b05 100644 --- a/apps/swift-ios/Features/Workspace/ProjectAndArchiveViews.swift +++ b/apps/swift-ios/Features/Workspace/ProjectAndArchiveViews.swift @@ -103,7 +103,6 @@ public struct AddProjectView: View { } } } - .preferredColorScheme(.dark) .onAppear(perform: selectEnvironmentIfNeeded) .onChange(of: model.snapshot.environments) { selectEnvironmentIfNeeded() @@ -532,16 +531,16 @@ public struct AddProjectView: View { HStack(spacing: 8) { if isSubmitting { ProgressView() - .tint(.black) + .tint(T3Colors.primaryActionForeground) } else { Image(systemName: icon) } Text(isSubmitting ? "Working…" : label) } .font(.body.weight(.semibold)) - .foregroundStyle(.black) + .foregroundStyle(T3Colors.primaryActionForeground) .frame(maxWidth: .infinity, minHeight: 48) - .background(Color.white, in: RoundedRectangle(cornerRadius: 12)) + .background(T3Colors.primaryAction, in: RoundedRectangle(cornerRadius: 12)) } .buttonStyle(.plain) .disabled(isSubmitting) diff --git a/apps/swift-ios/Features/Workspace/ProviderModelPicker.swift b/apps/swift-ios/Features/Workspace/ProviderModelPicker.swift index cc7ff098a7..6184ee05de 100644 --- a/apps/swift-ios/Features/Workspace/ProviderModelPicker.swift +++ b/apps/swift-ios/Features/Workspace/ProviderModelPicker.swift @@ -224,7 +224,6 @@ private struct ModelPickerSheet: View { } .presentationDetents([.large]) .presentationDragIndicator(.visible) - .preferredColorScheme(.dark) .onAppear(perform: revealSelectedLegacyModel) .onChange(of: selection) { revealSelectedLegacyModel() } .onChange(of: providers) { revealSelectedLegacyModel() } diff --git a/apps/swift-ios/Features/Workspace/WorkspaceView.swift b/apps/swift-ios/Features/Workspace/WorkspaceView.swift index 737c451d1e..6a6e57bc51 100644 --- a/apps/swift-ios/Features/Workspace/WorkspaceView.swift +++ b/apps/swift-ios/Features/Workspace/WorkspaceView.swift @@ -281,8 +281,8 @@ public struct WorkspaceView: View { .foregroundStyle(T3Colors.textSecondary) Button("New task", action: openNewTaskOrProjectCreation) .buttonStyle(.borderedProminent) - .tint(.white) - .foregroundStyle(.black) + .tint(T3Colors.primaryAction) + .foregroundStyle(T3Colors.primaryActionForeground) } .frame(maxWidth: .infinity, maxHeight: .infinity) .background(T3Colors.background) @@ -464,10 +464,10 @@ public struct WorkspaceView: View { } label: { Image(systemName: "square.and.pencil") .font(.system(size: 20, weight: .medium)) - .foregroundStyle(.black) + .foregroundStyle(T3Colors.primaryActionForeground) .frame(width: 52, height: 52) - .background(Color(white: 0.95), in: Circle()) - .shadow(color: .black.opacity(0.7), radius: 16, y: 8) + .background(T3Colors.primaryAction, in: Circle()) + .shadow(color: T3Colors.shadow, radius: 16, y: 8) } .buttonStyle(.plain) .accessibilityLabel("New task") @@ -513,7 +513,7 @@ public struct WorkspaceView: View { .font(.system(size: 8, weight: .bold)) } .font(T3Typography.homeMetadata.weight(.semibold)) - .foregroundStyle(Color.white.opacity(0.55)) + .foregroundStyle(T3Colors.textSecondary) .frame(maxWidth: .infinity, minHeight: 40, alignment: .leading) .contentShape(Rectangle()) } @@ -905,7 +905,7 @@ struct FeatureThreadRow: View, Equatable { ProjectBadge(name: context.projectName) Text(context.projectName) .lineLimit(1) - .foregroundStyle(Color.white.opacity(0.58)) + .foregroundStyle(T3Colors.textSecondary) Spacer(minLength: 8) status(at: now) } @@ -927,7 +927,7 @@ struct FeatureThreadRow: View, Equatable { if context.providerLooksTerminal { Text(">_") .font(.system(size: 9.5, weight: .bold, design: .monospaced)) - .foregroundStyle(Color(red: 0.37, green: 0.92, blue: 0.83)) + .foregroundStyle(T3Colors.syntaxProperty) } Spacer(minLength: 8) if let environmentLabel { @@ -955,7 +955,7 @@ struct FeatureThreadRow: View, Equatable { .padding(.vertical, 8) .frame(minHeight: 88) .background( - isSelected ? Color.white.opacity(0.09) : Color.clear, + isSelected ? T3Colors.subtleStrong : Color.clear, in: RoundedRectangle(cornerRadius: 8) ) .padding(.horizontal, 8) @@ -985,7 +985,7 @@ struct FeatureThreadRow: View, Equatable { .frame(minHeight: 44) .padding(.horizontal, 8) .background( - isSelected ? Color.white.opacity(0.07) : Color.clear, + isSelected ? T3Colors.subtleStrong : Color.clear, in: RoundedRectangle(cornerRadius: 7) ) } @@ -1021,12 +1021,12 @@ struct FeatureThreadRow: View, Equatable { private var statusColor: Color { switch thread.homeStatus { - case .working: Color(red: 0.22, green: 0.74, blue: 0.97) - case .approval: Color(red: 0.99, green: 0.77, blue: 0.27) - case .input: Color(red: 0.65, green: 0.71, blue: 0.99) + case .working: T3Colors.statusRunning + case .approval: T3Colors.warning + case .input: T3Colors.statusInput case .failed: T3Colors.danger - case .done: Color(red: 0.43, green: 0.91, blue: 0.72) - case .ready: Color.white.opacity(0.4) + case .done: T3Colors.success + case .ready: T3Colors.textTertiary } } @@ -1048,7 +1048,7 @@ struct FeatureThreadRow: View, Equatable { case .disconnected: T3Colors.danger.opacity(0.78) case .connected, nil: - Color.white.opacity(0.36) + T3Colors.textTertiary } } diff --git a/apps/swift-ios/T3Code.xcodeproj/project.pbxproj b/apps/swift-ios/T3Code.xcodeproj/project.pbxproj index 7e920b21ec..540f43cbc2 100644 --- a/apps/swift-ios/T3Code.xcodeproj/project.pbxproj +++ b/apps/swift-ios/T3Code.xcodeproj/project.pbxproj @@ -615,7 +615,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = Extensions/Shared/T3Code.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 9; + CURRENT_PROJECT_VERSION = 11; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Resources/Info.plist; @@ -673,7 +673,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = Extensions/Shared/T3Code.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 9; + CURRENT_PROJECT_VERSION = 11; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Resources/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "T3 Code SwiftUI"; @@ -764,7 +764,7 @@ APPLICATION_EXTENSION_API_ONLY = YES; CODE_SIGN_ENTITLEMENTS = Extensions/Widgets/T3CodeWidgets.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 9; + CURRENT_PROJECT_VERSION = 11; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Extensions/Widgets/Info.plist; INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO; @@ -795,7 +795,7 @@ APPLICATION_EXTENSION_API_ONLY = YES; CODE_SIGN_ENTITLEMENTS = Extensions/Widgets/T3CodeWidgets.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 9; + CURRENT_PROJECT_VERSION = 11; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Extensions/Widgets/Info.plist; INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO; @@ -828,7 +828,7 @@ APPLICATION_EXTENSION_API_ONLY = YES; CODE_SIGN_ENTITLEMENTS = Extensions/Share/T3CodeShare.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 9; + CURRENT_PROJECT_VERSION = 11; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Extensions/Share/Info.plist; INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO; @@ -859,7 +859,7 @@ APPLICATION_EXTENSION_API_ONLY = YES; CODE_SIGN_ENTITLEMENTS = Extensions/Share/T3CodeShare.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 9; + CURRENT_PROJECT_VERSION = 11; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Extensions/Share/Info.plist; INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO; diff --git a/apps/swift-ios/Tests/PlatformTests/PlatformAgentAwarenessTests.swift b/apps/swift-ios/Tests/PlatformTests/PlatformAgentAwarenessTests.swift index 74d2146237..070aee80d2 100644 --- a/apps/swift-ios/Tests/PlatformTests/PlatformAgentAwarenessTests.swift +++ b/apps/swift-ios/Tests/PlatformTests/PlatformAgentAwarenessTests.swift @@ -4,6 +4,20 @@ import Testing @Suite("Agent awareness projection") struct PlatformAgentAwarenessTests { + @Test + func settingsDefaultToSystemAppearanceAndRoundTripLightMode() throws { + #expect(FeatureSettings().appearance == .system) + + var settings = FeatureSettings() + settings.appearance = .light + let roundTrip = try JSONDecoder.t3.decode( + FeatureSettings.self, + from: JSONEncoder.t3.encode(settings) + ) + + #expect(roundTrip.appearance == .light) + } + @Test func legacySettingsEnableLiveActivitiesWithoutResettingOtherPreferences() throws { let legacy = Data(