mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
feat: added random Color and data type to the Store
This commit is contained in:
@@ -207,6 +207,10 @@ extension Color: CaseIterable {
|
||||
]
|
||||
}
|
||||
|
||||
public static var random: Color {
|
||||
Color.allColors[.random(in: 0...Color.allColors.count)]
|
||||
}
|
||||
|
||||
public static func fromString(_ key: String, defaultValue: Color = .systemAccent) -> Color {
|
||||
return Color.allCases.first{ $0.key == key } ?? defaultValue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user