another.im-ios/ConversationsClassic/Helpers/View+Debug.swift
fmodf b3b3b3aef7 mv-experiment (#1)
Reviewed-on: narayana/conversations-classic-ios#1
Co-authored-by: fmodf <fmodf.ios@gmail.com>
Co-committed-by: fmodf <fmodf.ios@gmail.com>
2024-09-03 15:13:58 +00:00

36 lines
801 B
Swift

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