import SwiftUI #if DEBUG private let rainbowDebugColors = [ Color.purple, Color.blue, Color.green, Color.yellow, Color.orange, Color.red, Color.pink, Color.black.opacity(0.5), Color.teal, Color.gray, Color.mint, Color.cyan ] public extension Color { static func random(randomOpacity: Bool = false) -> Color { Color( red: .random(in: 0 ... 1), green: .random(in: 0 ... 1), blue: .random(in: 0 ... 1), opacity: randomOpacity ? .random(in: 0 ... 1) : 1 ) } } extension View { func rainbowDebug() -> some View { background(Color.random()) } } #endif