From 11e409cbaa98e2dcfda1cf458d9550cc895e3e4f Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Wed, 9 Jul 2025 12:21:38 +0100 Subject: [PATCH] try to fix real time preview --- ShhShell/Views/Themes/ThemeButton.swift | 2 +- ShhShell/Views/Themes/ThemeEditorView.swift | 3 +-- ShhShell/Views/Themes/ThemePreview.swift | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ShhShell/Views/Themes/ThemeButton.swift b/ShhShell/Views/Themes/ThemeButton.swift index 2167e6e..d5d6232 100644 --- a/ShhShell/Views/Themes/ThemeButton.swift +++ b/ShhShell/Views/Themes/ThemeButton.swift @@ -43,7 +43,7 @@ struct ThemeButton: View { ) .padding(isSelected ? innerPadding : 0) - ThemePreview(theme: theme, padding: padding, paletteR: paletteR) + ThemePreview(theme: $theme, padding: padding, paletteR: paletteR) } .onTapGesture { hostsManager.selectTheme(theme) diff --git a/ShhShell/Views/Themes/ThemeEditorView.swift b/ShhShell/Views/Themes/ThemeEditorView.swift index d84800b..d62c2e1 100644 --- a/ShhShell/Views/Themes/ThemeEditorView.swift +++ b/ShhShell/Views/Themes/ThemeEditorView.swift @@ -20,7 +20,7 @@ struct ThemeEditorView: View { hostsManager.selectedTheme.background.suiColor.opacity(0.7) .ignoresSafeArea(.all) NavigationStack { - ThemePreview(theme: theme, padding: 10, paletteR: 20) + ThemePreview(theme: $theme, padding: 10, paletteR: 20) .id(theme) .padding(.bottom) .fixedSize(horizontal: false, vertical: true) @@ -32,7 +32,6 @@ struct ThemeEditorView: View { } Section("Main Colors") { - ColorPicker("Text", selection: $theme.foreground.suiColor, supportsOpacity: false) ColorPicker("Background", selection: $theme.background.suiColor, supportsOpacity: false) ColorPicker("Cursor", selection: $theme.cursor.suiColor, supportsOpacity: false) diff --git a/ShhShell/Views/Themes/ThemePreview.swift b/ShhShell/Views/Themes/ThemePreview.swift index 3827998..d8182a0 100644 --- a/ShhShell/Views/Themes/ThemePreview.swift +++ b/ShhShell/Views/Themes/ThemePreview.swift @@ -8,7 +8,7 @@ import SwiftUI struct ThemePreview: View { - @State var theme: Theme + @Binding var theme: Theme @State var padding: CGFloat @State var paletteR: CGFloat @@ -45,5 +45,5 @@ struct ThemePreview: View { } #Preview { - ThemePreview(theme: Theme.defaultTheme, padding: 5, paletteR: 10) + ThemePreview(theme: .constant(Theme.defaultTheme), padding: 5, paletteR: 10) }