Added theme colour section to settings

This commit is contained in:
breadone 2024-06-24 13:05:27 +12:00
parent 7abd5e3ba4
commit 71806c9ca4
No known key found for this signature in database
3 changed files with 33 additions and 16 deletions

View File

@ -32,20 +32,6 @@ struct MainView: View {
Image(systemName: "gear")
}
}
ToolbarItem(placement: .topBarTrailing) {
Menu {
Picker(selection: $filterColor) {
ForEach(Constants.colorText, id: \.self) { clr in
Text(clr)
}
} label: {
Text("Color")
}
.pickerStyle(.menu)
} label: {
Image(systemName: "line.3.horizontal.decrease.circle")
}
}
ToolbarItem(placement: .topBarTrailing) {
Button(action: { addNewProject.toggle() }) {
Label("Add Item", systemImage: "plus")

View File

@ -19,13 +19,15 @@ struct SettingsView: View {
@AppStorage(Preferences.teleSeparator) var teleprompterSeparator: String = "---"
@AppStorage(Preferences.teleDefaultSize) var teleDefaultSize = 45.0
@AppStorage(Preferences.teleAutoScroll) var teleAutoScroll = false
@AppStorage(Preferences.teleAutoScrollSpeed) var teleAutoScrollSpeed = 1.0
// @State private var themesColor: Color = .blue
@AppStorage(Preferences.themeColour) var themesColor = Color.blue.toHex()!
var body: some View {
NavigationView {
List {
generalSettings
cueCardSettings
teleprompterSettings
appleWatchSettings
@ -41,6 +43,29 @@ struct SettingsView: View {
}
}
var generalSettings: some View {
Section {
Text("Theme Color")
HStack {
ForEach(Constants.colors, id: \.self) { color in
if themesColor == color.toHex()! {
ZStack {
Circle()
.foregroundStyle(color)
// .strokeBorder(Color.white,lineWidth: 4)
// .background(Circle().foregroundStyle(color))
Image(systemName: "checkmark")
}
} else {
Circle()
.foregroundStyle(color)
.onTapGesture { themesColor = color.toHex()! }
}
}
}
} header: { Text("General") }
}
var cueCardSettings: some View {
Section {
Stepper("Default Text Size: \(cueDefaultSize.formatted())", value: $cueDefaultSize, in: 1...100)
@ -51,6 +76,9 @@ struct SettingsView: View {
Section {
Stepper("Default Text Size: \(teleDefaultSize.formatted())", value: $teleDefaultSize, in: 1...100)
Toggle("AutoScroll", isOn: $teleAutoScroll)
if teleAutoScroll {
Stepper("Default Autoscroll Speed: \(teleAutoScrollSpeed.formatted())", value: $teleAutoScrollSpeed, in: 0.1...10.0, step: 0.1)
}
} header: { Text("Teleprompter") }
}

View File

@ -11,8 +11,11 @@ public struct Preferences {
static let teleSeparator = "teleSeparator"
static let teleDefaultSize = "teleDefaultSize"
static let teleAutoScroll = "teleAutoScroll"
static let teleAutoScrollSpeed = "teleAutoScrollSpeed"
static let watchConnectivity = "watchConnectivity"
static let cueDefaultSize = "cueDefaultSize"
static let themeColour = "themeColour"
}