try to fix real time preview

This commit is contained in:
neon443
2025-07-09 12:21:38 +01:00
parent a3003a6e90
commit 11e409cbaa
3 changed files with 4 additions and 5 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)
}