mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-15 00:34:08 +09:00
feat: added an option to set colors for the State widget
This commit is contained in:
@@ -172,6 +172,14 @@ extension Color: CaseIterable {
|
||||
]
|
||||
}
|
||||
|
||||
public static var allColors: [Color] {
|
||||
return [.clear, .white, .black, .gray, .secondGray, .darkGray, .lightGray,
|
||||
.red, .secondRed, .green, .secondGreen, .blue, .secondBlue, .yellow, .secondYellow,
|
||||
.orange, .secondOrange, .purple, .secondPurple, .brown, .secondBrown,
|
||||
.cyan, .magenta, .pink, .teal, .indigo
|
||||
]
|
||||
}
|
||||
|
||||
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