Titel Farbe Problem

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Titel Farbe Problem

    Servus,
    Ich habe das Problem, dass ich den Titel für die Seite nicht färben kann.
    Ich habs versucht anzupassen, es soll nicht Schwarz sein sondern in diesem Gold/Beige Ton..
    Könntet ihr mir dabei kurz helfen?

    Viele Grüße

    Python-Quellcode

    1. import SwiftUI
    2. struct DhikrView: View {
    3. @State private var counters: [Counter] = [Counter(name: "test", count: 0)]
    4. @State private var showingAddCounter = false
    5. var body: some View {
    6. NavigationView {
    7. ZStack {
    8. Color(hex: "#10231d").edgesIgnoringSafeArea(.all)
    9. VStack {
    10. ScrollView {
    11. ForEach($counters) { $counter in
    12. CounterView(counter: $counter, onDelete: {
    13. if let index = counters.firstIndex(where: { $0.id == counter.id }) {
    14. counters.remove(at: index)
    15. }
    16. })
    17. .padding(.bottom)
    18. }
    19. }
    20. .frame(maxHeight: 600)
    21. .scrollIndicators(.never) // Hide the scroll indicators
    22. }
    23. .navigationBarTitleDisplayMode(.inline)
    24. .toolbar {
    25. ToolbarItem(placement: .navigationBarTrailing) {
    26. Button(action: {
    27. showingAddCounter.toggle()
    28. }) {
    29. Image(systemName: "plus")
    30. .foregroundColor(Color(hex: "#bcad82"))
    31. }
    32. }
    33. }
    34. .sheet(isPresented: $showingAddCounter) {
    35. AddCounterView(counters: $counters)
    36. }
    37. }
    38. .navigationTitle("Dhikr")
    39. .foregroundColor(Color(hex: "#bcad82")) // Set title color to gold
    40. .font(.headline)
    41. }
    42. }
    43. }
    44. struct Counter: Identifiable {
    45. let id = UUID()
    46. var name: String
    47. var count: Int = 0
    48. }
    49. struct CounterView: View {
    50. @Binding var counter: Counter
    51. var onDelete: () -> Void
    52. var body: some View {
    53. VStack {
    54. Text(counter.name)
    55. .font(.headline)
    56. .foregroundColor(Color(hex: "#bcad82"))
    57. Button(action: {
    58. counter.count += 1
    59. let generator = UIImpactFeedbackGenerator(style: .medium)
    60. generator.impactOccurred()
    61. withAnimation(.easeInOut) {
    62. counter.count += 0
    63. }
    64. }) {
    65. ZStack {
    66. Circle()
    67. .fill(Color(hex: "#bcad82"))
    68. .frame(width: 110, height: 110)
    69. Text("\(counter.count)")
    70. .font(.largeTitle)
    71. .foregroundColor(Color(hex: "#10231d"))
    72. }
    73. }
    74. .contextMenu {
    75. Button(role: .destructive) {
    76. onDelete()
    77. } label: {
    78. Label("Löschen", systemImage: "trash")
    79. }
    80. Button(action: {
    81. counter.count = 0
    82. }) {
    83. Label("Zurücksetzen", systemImage: "arrow.counterclockwise")
    84. }
    85. }
    86. .onLongPressGesture {
    87. counter.count = 0
    88. }
    89. }
    90. .padding()
    91. .background(Color(hex: "#10231d"))
    92. .cornerRadius(8)
    93. }
    94. }
    95. struct AddCounterView: View {
    96. @Environment(\.presentationMode) var presentationMode
    97. @Binding var counters: [Counter]
    98. @State private var name = ""
    99. var body: some View {
    100. NavigationView {
    101. Form {
    102. Section(header: Text("Name")) {
    103. TextField("Vergebe einen Namen", text: $name)
    104. }
    105. }
    106. .navigationBarTitle("Dhikr", displayMode: .inline)
    107. .toolbar {
    108. ToolbarItem(placement: .navigationBarLeading) {
    109. Button("Abbrechen") {
    110. presentationMode.wrappedValue.dismiss()
    111. }
    112. }
    113. ToolbarItem(placement: .navigationBarTrailing) {
    114. Button("Speichern") {
    115. let newCounter = Counter(name: name)
    116. counters.append(newCounter)
    117. presentationMode.wrappedValue.dismiss()
    118. }
    119. }
    120. }
    121. }
    122. }
    123. }
    124. #Preview {
    125. DhikrView()
    126. }
    Alles anzeigen